使用hydra和vcr gem时请求不运行

时间:2015-01-09 13:41:45

标签: ruby-on-rails ruby rubygems vcr hydra

我正在尝试使用typheous和hyrda进行发布请求。我正在使用VCR gem来测试响应。

我目前收到以下错误:ArgumentError:        Array与Array的比较失败 当我运行这一行时: hydra.run

我的要求如下:

<Typhoeus::Request:0x007fb7523a8688 @base_url="http://dev.moodle.co.za/webservice/rest/server.php?", @original_options={:method=>:get, :params=>{:wstoken=>"7d7ed6cc23c8143e4baaa39b51", :moodlewsrestformat=>"json", :wsfunction=>"enrol_manual_enrol_users ", :enrolments=>{"0"=>{:roleid=>5, :userid=>61, :courseid=>96}}}, :headers=>{:Accept=>"json"}}, @options={:method=>:get, :params=>{:wstoken=>"7d7ed6cc23c8143e4baaa39b515b10af", :moodlewsrestformat=>"json", :wsfunction=>"enrol_manual_enrol_users ", :enrolments=>{"0"=>{:roleid=>5, :userid=>61, :courseid=>96}}}, :headers=>{"User-Agent"=>"Typhoeus - https://github.com/typhoeus/typhoeus", :Accept=>"json"}, :maxredirs=>50}>

如果我删除了userid和course id它工作正常,但只要[0]有一个数组成员,我就会得到上面提到的错误。

此外,如果我删除VCR gem,那么它工作正常。

任何建议如何解决这个问题

Failure/Error: expect(person.moodle_create_user()).to eq(["id"=>"5nasCrYKc5", "username"=>"testing_moodle_gem"])
     ArgumentError:
       comparison of Array with Array failed
     # ./lib/moodle/request.rb:31:in `run_request'
     # ./lib/moodle/request.rb:14:in `execute_request'
     # ./lib/moodle/request.rb:19:in `execute_and_return_response_body'
     # ./lib/moodle/person.rb:11:in `moodle_create_user'
     # ./spec/moodle/person_spec.rb:30:in `block (4 levels) in <top (required)>'
     # ./spec/moodle/person_spec.rb:29:in `block (3 levels) in <top (required)>'

0 个答案:

没有答案