1

我目前正在尝试在使用 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}>

如果我删除用户 ID 和课程 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)>'
4

0 回答 0