0

我正在尝试使用集成测试来测试我的 Grape::APIspecs/requests

我只使用 RSpec,而不是 capybara 或任何东西。

我只是想在我的集成规范中发布数据,我不断得到undefined method 'to_sym'

这是我到目前为止所拥有的

    before do
      post "/v1/users", { :user => {
        :username => "testuser", :password => "pass", :password_confirmation => "pass" } 
      }.to_xml, @api_key.merge({'HTTP_CONTENT_TYPE' => 'application/xml'})
    end

@api_key merely持有HTTP_AUTHORIZATION标题

我在这里做错了什么?我已经为此奋斗了好几个小时:(

堆栈跟踪:

grape (0.2.1.1) lib/grape/middleware/base.rb:74:in `content_type_for'
grape (0.2.1.1) lib/grape/middleware/formatter.rb:29:in `before'
grape (0.2.1.1) lib/grape/middleware/base.rb:24:in `call!'
grape (0.2.1.1) lib/grape/middleware/base.rb:19:in `call'
grape (0.2.1.1) lib/grape/middleware/base.rb:25:in `call!'
grape (0.2.1.1) lib/grape/middleware/base.rb:19:in `call'
grape (0.2.1.1) lib/grape/middleware/error.rb:44:in `block in call!'
grape (0.2.1.1) lib/grape/middleware/error.rb:43:in `catch'
grape (0.2.1.1) lib/grape/middleware/error.rb:43:in `call!'
grape (0.2.1.1) lib/grape/middleware/base.rb:19:in `call'
rack (1.4.5) lib/rack/head.rb:9:in `call'
rack (1.4.5) lib/rack/builder.rb:134:in `call'
grape (0.2.1.1) lib/grape/endpoint.rb:113:in `call!'
grape (0.2.1.1) lib/grape/endpoint.rb:103:in `call'
rack-mount (0.8.3) lib/rack/mount/route_set.rb:152:in `block in call'
rack-mount (0.8.3) lib/rack/mount/code_generation.rb:96:in `block in recognize'
rack-mount (0.8.3) lib/rack/mount/code_generation.rb:68:in `optimized_each'
rack-mount (0.8.3) lib/rack/mount/code_generation.rb:95:in `recognize'
rack-mount (0.8.3) lib/rack/mount/route_set.rb:141:in `call'
grape (0.2.1.1) lib/grape/api.rb:404:in `call'
grape (0.2.1.1) lib/grape/api.rb:51:in `call!'
grape (0.2.1.1) lib/grape/api.rb:47:in `call'
4

1 回答 1

1

这似乎是您正在使用的版本中的错误 - 更新到最新版本的葡萄以解决此问题(0.4.1此时)。

于 2013-05-28T20:26:14.550 回答