我的规格通过,直到我在生成的控制器中更改为respond_with。我在github上遇到了this问题,但它在不久前关闭了。我很难过接下来要做什么。我该如何解决这个问题?
#campaigns_controller.rb
# POST /campaigns
# POST /campaigns.json
def create
@campaign = Campaign.new(params[:campaign])
respond_with(@campaign)
end
#campaigns_controller_spec.rb
describe "with valid params" do
it "creates a new Campaign" do
expect {
post :create, :campaign => valid_attributes
}.to change(Campaign, :count).by(1)
end
Errors:
Failure/Error: expect {
count should have been changed by 1, but was changed by 0