spec/unit/admin_policy_spec.rb in hydra-access-controls-9.0.0.beta1 vs spec/unit/admin_policy_spec.rb in hydra-access-controls-9.0.0.beta2
- old
+ new
@@ -2,20 +2,20 @@
describe Hydra::AdminPolicy do
describe "when setting attributes" do
before do
- subject.title = "My title"
- subject.description = "My description"
+ subject.title = ["My title"]
+ subject.description = ["My description"]
end
its(:title) { is_expected.to eq "My title"}
its(:description) { is_expected.to eq "My description"}
end
describe "to_solr" do
- subject { Hydra::AdminPolicy.new(:title=>"Foobar").to_solr }
+ subject { Hydra::AdminPolicy.new(:title=>["Foobar"]).to_solr }
it "should have title_ssim" do
expect(subject[ActiveFedora::SolrQueryBuilder.solr_name('title', type: :string)]).to eq ["Foobar"]
end
end
@@ -40,15 +40,15 @@
expect(subject.default_permissions.map(&:to_hash)).to eq [{:type=>'person', :access=>'discover', :name=>'user1'},
{:type=>'person', :access=>'discover', :name=>'user2'}]
end
it "should update permissions on existing users" do
subject.default_permissions.build({:name=>'user1', :access=>'discover', :type=>'person'})
- subject.default_permissions.first.mode = ::ACL.Write
+ subject.default_permissions.first.mode = Hydra::AccessControls::Mode.new(::ACL.Write)
expect(subject.default_permissions.map(&:to_hash)).to eq [{:type=>'person', :access=>'edit', :name=>'user1'}]
end
it "should update permissions on existing groups" do
subject.default_permissions.build({:name=>'group1', :access=>'discover', :type=>'group'})
- subject.default_permissions.first.mode = ::ACL.Write
+ subject.default_permissions.first.mode = Hydra::AccessControls::Mode.new(::ACL.Write)
expect(subject.default_permissions.map(&:to_hash)).to eq [{:type=>'group', :access=>'edit', :name=>'group1'}]
end
it "should assign user permissions when :type == 'person'" do
subject.default_permissions.build({:name=>'user1', :access=>'discover', :type=>'person'})
expect(subject.default_permissions.map(&:to_hash)).to eq [{:type=>'person', :access=>'discover', :name=>'user1'}]