[rspec-users] UJS plugin incompatible with RSpec?

brian ford brixen at gmail.com
Thu Dec 7 19:33:06 EST 2006


Hi all,

Anyone using UJS with RSpec? I have the following view spec:

---- edit_spec.rb
context "accounts/edit" do
  fixtures :users

  setup do
    assigns[:user] = users(:consumer)
  end

  specify "should display the user info to edit" do
    render '/accounts/edit'
  end
end
---- end

that causes this exception:

---- exception
ActionView::TemplateError in 'accounts/edit should display the user
info to edit'
undefined method `set_default_external!' for #<#<Class:0x362f964>:0x362ed98>
On line #3 of app/views/accounts/edit.rhtml

    1: <div id="primary_content">
    2:  <h1>Update user information</h1>
    3:  <%= form_tag account_url(@user), :method => :put %>
    4:  <%= render :partial => 'user' %>

    /opt/local/lib/ruby/gems/1.8/gems/rspec-0.7.4/lib/spec/expectations/sugar.rb:13:in
`call'
    /opt/local/lib/ruby/gems/1.8/gems/rspec-0.7.4/lib/spec/expectations/sugar.rb:13:in
`_method_missing'
    /opt/local/lib/ruby/gems/1.8/gems/rspec-0.7.4/lib/spec/expectations/sugar.rb:9:in
`method_missing'
    #{RAILS_ROOT}/vendor/plugins/unobtrusive_javascript/lib/tag_helper_patches.rb:17:in
`tag_options'
    #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/helpers/tag_helper.rb:14:in
`tag'
    #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/helpers/form_tag_helper.rb:47:in
`form_tag'
    #{RAILS_ROOT}/app/views//accounts/edit.rhtml:3:in
`_run_rhtml_47app47views47accounts47edit46rhtml'
    #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:328:in
`compile_and_render_template'
    #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:303:in
`render_template'
    #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:263:in
`render_file'
    #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:786:in
`render_file'
    #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:724:in
`render_with_no_layout'
    #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/layout.rb:256:in
`render_without_benchmark'
    #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:50:in
`render'
    /opt/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
    #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:50:in
`render'
    /Users/brian/devel/deluxe/TRY-ujs-fix/vendor/plugins/rspec/lib/spec/rails/context/view.rb:74:in
`render'
    spec/views/accounts/edit_spec.rb:11
    /opt/local/lib/ruby/gems/1.8/gems/rspec-0.7.4/lib/spec/runner/specification.rb:55:in
`execute_spec'
    /opt/local/lib/ruby/gems/1.8/gems/rspec-0.7.4/lib/spec/runner/specification.rb:30:in
`run'
    /opt/local/lib/ruby/gems/1.8/gems/rspec-0.7.4/lib/spec/runner/context.rb:45:in
`run'
    /opt/local/lib/ruby/gems/1.8/gems/rspec-0.7.4/lib/spec/runner/context.rb:44:in
`run'
    /opt/local/lib/ruby/gems/1.8/gems/rspec-0.7.4/lib/spec/runner/context_runner.rb:23:in
`run'
    /opt/local/lib/ruby/gems/1.8/gems/rspec-0.7.4/lib/spec/runner/context_runner.rb:22:in
`run'
    /opt/local/lib/ruby/gems/1.8/gems/rspec-0.7.4/lib/spec/runner/command_line.rb:26:in
`run'
    /opt/local/lib/ruby/gems/1.8/gems/rspec-0.7.4/bin/spec:4
---- end

RSpec and rspec_on_rails are 0.7.4. UJS is installed from
http://source.ujs4rails.com/current/unobtrusive_javascript.

The same error happens regardless of whether I use form_for or
form_tag. It renders fine from a normal request.

TIA,
Brian


More information about the rspec-users mailing list