On Apr 23, 8:58 pm, Anders_P <[email protected]> wrote:
> Hello!
>
>
>
> And:
>
> class NewsletterReceiversController < ApplicationController
>   def create
>     @newsletter_receiver =
> NewsletterReceiver.new(params[:newsletter_receiver])
>     if @newsletter_receiver.save
>       flash[:notice] = "A message"
>       redirect_to root_path
>     else
>       render 'pages/home'
>     end
>   end
> end
>
> My NewsletterReceiversController specs looks like this:
>
> require 'spec_helper'
>
> describe NewsletterReceiversController do
>
>   describe "Success" do
>
>       before(:each) do
>         @attr = { :email => "[email protected]" }
>       end
>
>       it "should create a receiver" do
>         lambda do
>           post :create, :newsletter_reveiver => @attr
>         end.should change(NewsletterReceiver, :count).by(1)
>       end

Step through your code and you'll see that you've got a typo here.

Fred

>     end
>   end
> end
>
> This gives me the following error:
>
> Failure/Error: lambda do
>   count should have been changed by 1, but was changed by 0
>
> Anyone got any tips on how to solve this?
>
> Thanks
> // Anders

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to