On Oct 14, 2011, at 12:01 AM, Gordon wrote:

>> Let's see the helper method please.
> 
>  # sets up an instance of a admin user
>  def login_admin_user
>    before(:each) do
>      @request.env["devise.mapping"] = Devise.mappings[:user]
>      @admin_user = FactoryGirl.create(:admin)
>      sign_in @admin_user
>    end
>  end
> end

>    context 'with an admin user signed in' do    # <----- starts failing in 
> this context
>        before(:each) do
>            login_admin_user
>        end

login_admin_user creates a before hook, but here it's _in a before hook_. That 
doesn't work. Try:

context 'with an admin user signed in' do
  login_admin_user # not inside a before hook
  it '...' do
     # ....
  end
end

> 
>        describe "creates a new brand entry" do
>            it "assigns a new brand as @brand" do
>                get :new
>                assigns(:brand).should be_a_new(Brand)
>            end
>        end
>    end
> end

HTH,
David
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to