This is very easy question but I cannot find any solution for this. It has been 3 days. Please help.
So I have this in
users_controller.rb
def index
@users = @users.normal.order(:name).page params[:page]
end
So I have this in my users_controller_spec.rb
it "assign all normal users to @users" do
users = User.normal.all
get :index
expect(assigns(:users)).to eq(users)
end
My code is based from https://www.relishapp.com/rspec/rspec-rails/docs/controller-specs .
After running rspec in my terminal, this is the output.
Diff:
@@ -1,4 +1,4 @@
-[#<User:0x00000004aa32b0
+[#<User:0x00000004a085a8
id: 2,
name: "Christian Galamay",
admin: false,
@@ -20,7 +20,7 @@
updated_at: Wed, 13 Apr 2016 01:46:17 UTC +00:00,
role: "Normal",
avatar: nil>,
- #<User:0x00000004aa2ea0
+ #<User:0x000000049dbd78
id: 3,
name: "Grace Sojor",
admin: false,
@@ -42,7 +42,7 @@
updated_at: Wed, 13 Apr 2016 01:46:17 UTC +00:00,
role: "Normal",
avatar: nil>,
- #<User:0x00000004aa2ab8
+ #<User:0x000000049db760
id: 4,
name: "Karl Pandacan",
admin: false,
The output says all the values are the same except with the hex after the User. So my question is (1) Why the hex after User is included in comparing the two ActiveRecord (2) Is there any method or function to use to ignore the hex in User. Thank You