Skip to content

Instantly share code, notes, and snippets.

@pbonnell
Created June 24, 2011 20:33
Show Gist options
  • Select an option

  • Save pbonnell/1045623 to your computer and use it in GitHub Desktop.

Select an option

Save pbonnell/1045623 to your computer and use it in GitHub Desktop.
this fails @ l.5 in SPEC ONLY - on dev/browser record after .save is identical to a dump in the test
it "should create a new notice", :real_db => true do
@_before = Admin::Notice.count
post :create, @post_params
Admin::Notice.should_receive(:create).with(@post_params).and_return(1)
Admin::Notice.count.should == @_before + 1 #<= FAILS HERE ?
response.should redirect_to('/admin/notices/info')
end
# SPEC FAIL :
# Failure/Error: Admin::Notice.count.should == @_before + 1
# expected: 1
# got: 0 (using ==)
# Controller : standard
# POST /admin/notices
# POST /admin/notices.xml
def create
@admin_notice = @type.new(params[:notice])
respond_to do |format|
if @admin_notice.save
format.html { redirect_on_type('Notice was successfully created.') }
format.xml { render :xml => @admin_notice, :status => :created, :location => @admin_notice }
else
format.html { render :action => "new" }
format.xml { render :xml => @admin_notice.errors, :status => :unprocessable_entity }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment