Reputation: 2165
This returns a false test every time. I also used the be_an_instance_of matcher.
def new
@partner_setting = PartnerSetting.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @partner_setting }
end
it 'assigns a valid partner settings object to @partner_setting' do
expect( assigns(:partner_setting) ).to be_an PartnerSetting
end
Upvotes: 0
Views: 33
Reputation: 2165
On a side note:
it 'the action assigns a non nil and valid Object to @partner_setting' do
expect(assigns(:partner_setting)).should_not be_nil
expect(assigns(:partner_setting)).to be_an Object
end
WORKS!!! Even if get #new ISN'T called!
The default action is to redirect to sign in page!
Upvotes: 0
Reputation: 387
You need to tell your test to go to a controller action. How else will it know what to test? So before your expect, you need to add.
get :new
Upvotes: 1
Reputation: 750
I don't see a
get :new
in your code. You have to call a controller action first.
Upvotes: 1