Skip to content

Could not get expect nil to work #5

@kwokster10

Description

@kwokster10

I tried this in a controller spec:

let(:model) { FactoryGirl.create(:model) }

it 'association does not equal nil' do
     post :add_assocation, { <necessary_params> }
     expect{ model.reload.association }.to eventually_not eq nil
end

Also tried:

 expect{ model.association }.to eventually_not eq nil
 expect{ model.reload.association }.to_not eventually eq nil
 expect{ model.reload.association }.to eventually_not(eq nil)
 expect{ model.reload.association }.to eventually_not(eq nil).within 5

here's the error message:

After 46 tries, the last failure message was:

       expected: nil
            got: nil

       (compared using ==)

Model and association have a one to one relationship.

Any advice would be appreciated.
Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions