Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rspec test fail with: Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id #42

Open
RaeuberKneissl opened this issue Feb 27, 2013 · 0 comments

Comments

@RaeuberKneissl
Copy link

Hi,

I am getting an error in rspec. In the view itself it works without a problem.

Here is how i use it:
config/will_filter/config.yml is not changed.

model client.rb:
belongs_to :license
has_one :license_key

clients_controller.rb:
def index
@Clients = Client.filter(:params => params)
end

index.html.haml:
%p= will_filter_tag(@Clients)
= will_filter_table_tag(@Clients)

index.html.haml_spec.rb:
require 'spec_helper'

describe "clients/index" do
before(:each) do
assign(:clients, [
stub_model(Client),
stub_model(Client)
])
end

it "renders a list of clients" do
render
end
end

RSpec error message:
Failures:

  1. clients/index renders a list of clients
    Failure/Error: render
    ActionView::Template::Error:
    Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id

    ./app/views/clients/index.html.haml:1:in `_app_views_clients_index_html_haml__2707070858207547506_2179859460'

    ./spec/views/clients/index.html.haml_spec.rb:12:in`block (2 levels) in <top (required)>'

I can't find the cause for the failing rspec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant