Hello everyone, in a test helper in my app I call category.id that gets the id of category in the database. However, when running RSpec I get the following error:
As a parla customer
/Users/saulolopes/code/parla/spec/acceptance/support/paths.rb:13: warning: Object#id will be deprecated; use Object#object_id
/Users/saulolopes/code/parla/spec/acceptance/support/paths.rb:13: warning: Object#id will be deprecated; use Object#object_id
/Users/saulolopes/code/parla/spec/acceptance/support/paths.rb:13: warning: Object#id will be deprecated; use Object#object_id
/Users/saulolopes/code/parla/spec/acceptance/support/paths.rb:13: warning: Object#id will be deprecated; use Object#object_id
/Users/saulolopes/code/parla/spec/acceptance/support/paths.rb:13: warning: Object#id will be deprecated; use Object#object_id
/Users/saulolopes/code/parla/spec/acceptance/support/paths.rb:13: warning: Object#id will be deprecated; use Object#object_id
I can’t change id method to object_id because they’re totally different things. One is the actual id of the model instance, other is the object_id Ruby gives to any of its objects.
Hello everyone, in a test helper in my app I call category.id that gets the
id of category in the database. However, when running RSpec I get the
following error:
As a parla customer
/Users/saulolopes/code/parla/spec/acceptance/support/paths.rb:13: warning:
Object#id will be deprecated; use Object#object_id
/Users/saulolopes/code/parla/spec/acceptance/support/paths.rb:13: warning:
Object#id will be deprecated; use Object#object_id
/Users/saulolopes/code/parla/spec/acceptance/support/paths.rb:13: warning:
Object#id will be deprecated; use Object#object_id
/Users/saulolopes/code/parla/spec/acceptance/support/paths.rb:13: warning:
Object#id will be deprecated; use Object#object_id
/Users/saulolopes/code/parla/spec/acceptance/support/paths.rb:13: warning:
Object#id will be deprecated; use Object#object_id
/Users/saulolopes/code/parla/spec/acceptance/support/paths.rb:13: warning:
Object#id will be deprecated; use Object#object_id
I can't change id method to object_id because they're totally different
things. One is the actual id of the model instance, other is the object_idRuby gives to any of its objects.
Does anyone know the solution for this problem?
This can happen because the object you're calling id on isn't what you
think it is (eg it's nil)
It would be worth posting the spec code too. In addition to Fred's
suggestion, I'd wonder whether you might have accidentally used
Model.id rather than model.id somewhere...
Oh yes, actually, this code isn’t a actual spec, it is a file in spec/acceptance/support/paths.rb, there is the code:
module NavigationHelpers
# Put helper methods related to the paths in your application here.
def homepage
"/"
end
def start_order_page
"/categories"
end
def products_page category
"/categories/#{category.id}/products"
end
def new_pizza_page
"/pizzas/new"
end
end
RSpec.configuration.include NavigationHelpers, :type => :acceptance
please tell me what's wrong with this,
Thanks!
Hello everyone, in a test helper in my app I call category.id that gets the
id of category in the database. However, when running RSpec I get the
following error:
As a parla customer
/Users/saulolopes/code/parla/spec/acceptance/support/paths.rb:13: warning:
Object#id will be deprecated; use Object#object_id
I use category[:id] instead and it always works as expected. Clumsy, a kludge,
but it works.