spec/auth/legacy_permissions_spec.rb in ddr-models-2.0.0.pre.1 vs spec/auth/legacy_permissions_spec.rb in ddr-models-2.0.0.pre.2
- old
+ new
@@ -1,9 +1,9 @@
module Ddr::Auth
RSpec.describe LegacyPermissions do
- subject { described_class.new(obj.permissions) }
+ subject { described_class.new(obj) }
let(:obj) { FactoryGirl.build(:item) }
before do
@deprecation_behavior = Deprecation.default_deprecation_behavior
@@ -15,21 +15,23 @@
after do
Deprecation.default_deprecation_behavior = @deprecation_behavior
end
- it "should be able to convert the permissions to policy roles" do
- expect(subject.to_policy_roles)
- .to eq(Roles::DetachedRoleSet.new([Roles::Role.build(type: "Editor", agent: "Editors", scope: "policy"),
- Roles::Role.build(type: "Viewer", agent: "public", scope: "policy"),
- Roles::Role.build(type: "Viewer", agent: "bob@example.com", scope: "policy")]))
+ it "should convert the permissions to resource roles" do
+ expect(subject.to_roles)
+ .to eq(Roles::DetachedRoleSet.new(
+ [ Roles::Role.build(type: "Editor", agent: "Editors", scope: "resource"),
+ Roles::Role.build(type: "Viewer", agent: "public", scope: "resource"),
+ Roles::Role.build(type: "Viewer", agent: "bob@example.com", scope: "resource")
+ ]
+ ))
end
- it "should be able to convert the permissions to resource roles" do
- expect(subject.to_resource_roles)
- .to eq(Roles::DetachedRoleSet.new([Roles::Role.build(type: "Editor", agent: "Editors", scope: "resource"),
- Roles::Role.build(type: "Viewer", agent: "public", scope: "resource"),
- Roles::Role.build(type: "Viewer", agent: "bob@example.com", scope: "resource")]))
+ it "should clear the legacy permissions" do
+ expect(obj.permissions).not_to be_empty
+ subject.clear
+ expect(obj.permissions).to be_empty
end
-
+
end
end