在RSpec 3請求測試遷移後失敗。 這裏是我的測試RSpec 3錯誤在請求測試中未定義方法'get'
describe 'GET /api/v1/activities' do
let!(:user) { create(:user) }
subject { json['activities'] }
context 'when not authenticated' do
let(:token) { user.authentication_token }
let(:email) { '[email protected]' }
before :each do
get '/api/v1/activities', {}, {token: token, email: email}
end
it { expect(response).to_not be_success }
end
end
這裏是rspec的日誌
Activities GET /api/v1/activities when not authenticated
Failure/Error: get '/api/v1/activities', {}, {token: token, email: email}
NoMethodError:
undefined method `get' for #<RSpec::ExampleGroups::Activities::GETApiV1Activities::WhenNotAuthenticated:0x0000000becfaf8>
這裏是什麼地方?
我在'spec_helper'' config.include Requests :: JsonHelpers,type :: request'中有這個字符串,是不是一樣?此外,我已經找到了可以幫助我的解決方案,但是我沒有足夠的信譽來同時發佈它。您如何看待我和您的解決方案是相對的? –