这应该是一个简单的,但是找不到为什么导致测试失败.
运行rspec时,我收到以下错误.但是在发表了“发送”方式之后,一切正常.
运行rspec时,我收到以下错误.但是在发表了“发送”方式之后,一切正常.
1) Messages GET /messages works! (now write some real specs) Failure/Error: get target_app_messages_path(@message.target_app.id) ArgumentError: wrong number of arguments (2 for 0) # ./app/controllers/messages_controller.rb:37:in `send'
的routes.rb@H_404_6@
resources :target_apps do resources :messages do member do post 'send' end end end
class Message include Mongoid::Document belongs_to :target_app end
class MessagesController < ApplicationController def index ... end def show ... end ... def send ... end end
/spec/requests/message_spec.rb@H_404_6@
describe "Messages" do describe "GET /messages" do let(:message) do FactoryGirl.create(:message) end it "works! (now write some real specs)" do # Run the generator again with the --webrat flag if you want to use webrat methods/matchers get target_app_messages_path(message.target_app.id) response.status.should be(200) end end