[rspec-users] PUT- or POST-ing xml

David Chelimsky dchelimsky at gmail.com
Thu Oct 4 18:25:07 EDT 2007


On 10/4/07, Geoffrey Wiseman <geoffrey.wiseman at gmail.com> wrote:
> I'd like to write a test of a REST service wherein XML is submitted as the
> request entity.
>
> In Test::Unit on Rails, this seems to be possible in an integration test,
> but not in a functional test.  RSpec uses the Rails functional test
> framework, as far as I can tell, so it suffers the same result; it tries to
> symbolize the keys of the 'parameters' hash, except the parameters aren't a
> hash:
>
> > 1)
> > NoMethodError in 'Assign Roles to Users should assign a single role'
> > undefined method `symbolize_keys' for #<String:0xb722d71c>
> >
> /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/test_process.rb:101:in
> `assign_parameters'
> > /usr/lib/ruby/gems/1.8/gems/actionpack-
> 1.13.3/lib/action_controller/test_process.rb:377:in
> `process'
> >
> /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/test_process.rb:353:in
> `put'
> > ./spec/controllers/assign_role_to_users_spec.rb:42:
> >
> /usr/lib/ruby/gems/1.8/gems/rspec-1.0.8/lib/spec/dsl/example.rb:81:in
> `instance_eval'
> >
> /usr/lib/ruby/gems/1.8/gems/rspec-1.0.8/lib/spec/dsl/example.rb:81:in
> `run_example'
> > /usr/lib/ruby/gems/1.8/gems/rspec-
> 1.0.8/lib/spec/dsl/example.rb:26:in `run'
> > /usr/lib/ruby/1.8/timeout.rb:48:in `timeout'
> >
> /usr/lib/ruby/gems/1.8/gems/rspec-1.0.8/lib/spec/dsl/example.rb:24:in
> `run'
> > /usr/lib/ruby/gems/1.8/gems/rspec-1.0.8
> /lib/spec/dsl/behaviour.rb:81:in `run'
> >
> /usr/lib/ruby/gems/1.8/gems/rspec-1.0.8/lib/spec/dsl/behaviour.rb:75:in
> `each'
> >
> /usr/lib/ruby/gems/1.8/gems/rspec-1.0.8/lib/spec/dsl/behaviour.rb:75:in
> `run'
> > /usr/lib/ruby/gems/1.8/gems/rspec-
> 1.0.8/lib/spec/runner/behaviour_runner.rb:58:in
> `run_behaviours'
> >
> /usr/lib/ruby/gems/1.8/gems/rspec-1.0.8/lib/spec/runner/behaviour_runner.rb:57:in
> `each'
> >
> /usr/lib/ruby/gems/1.8/gems/rspec-1.0.8/lib/spec/runner/behaviour_runner.rb:57:in
> `run_behaviours'
> >
> /usr/lib/ruby/gems/1.8/gems/rspec-1.0.8/lib/spec/runner/behaviour_runner.rb:21:in
> `run'
> >
> /usr/lib/ruby/gems/1.8/gems/rspec-1.0.8/lib/spec/runner/command_line.rb:17:in
> `run'
> > /usr/lib/ruby/gems/1.8/gems/rspec- 1.0.8/bin/spec:3:
> > /usr/bin/spec:16:in `load'
> > /usr/bin/spec:16:
> >
> > Finished in 0.594615 seconds
>
> Thoughts?  Has anyone found a way around this with the current (1.0.8)
> RSpec?  Is this something that is addressed by the Story Runner in trunk?

Story/Scenario Runner is indeed your solution. For Rails apps it wraps
rails integration tests.

>
> Thanks in advance for any advice,
>
>  - Geoffrey
> --
> Geoffrey Wiseman
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list