require 'spec_helper' describe Permission do before(:each) do @permission_1 = Permission.new({:role_id => 1,:model => 'Role'}) @permission_2 = Permission.new({:role_id => 1,:model => 'Role'}) @permission_3 = Permission.new({:role_id => 2,:model => 'Role'}) @permission_4 = Permission.new({:role_id => 1,:model => 'User'}) end it "should be equal if the role and model are the same" do (@permission_1 == @permission_2).should be_true end it "should NOT be equal if the roles are different" do (@permission_1 == @permission_3).should be_false end it "should NOT be equal if the models are different" do (@permission_1 == @permission_4).should be_false end end