spec/auth/ability_spec.rb in ddr-models-2.0.0.pre.3 vs spec/auth/ability_spec.rb in ddr-models-2.0.0.pre.4

- old
+ new

@@ -144,26 +144,26 @@ describe "role based abilities" do shared_examples "it has role based abilities" do describe "when permissions are cached" do before { subject.cache[cache_key] = [ Permissions::READ ] } it "should use the cached permissions" do - expect_any_instance_of(RoleBasedAbilityDefinitions).not_to receive(:effective_permissions) + expect(perm_obj).not_to receive(:effective_permissions) expect(subject).to be_able_to(:read, obj) expect(subject).not_to be_able_to(:edit, obj) end end describe "when permissions are not cached" do describe "and user context has role based permission" do before do - allow_any_instance_of(RoleBasedAbilityDefinitions).to receive(:effective_permissions).with(perm_obj) do + allow(perm_obj).to receive(:effective_permissions) do [ Permissions::UPDATE ] end end it { should be_able_to(:edit, obj) } end describe "and user context does not have role based permission" do before do - allow_any_instance_of(RoleBasedAbilityDefinitions).to receive(:effective_permissions).with(perm_obj) do + allow(perm_obj).to receive(:effective_permissions) do [ Permissions::READ ] end end it { should_not be_able_to(:edit, obj) } end