Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Passing a User was previously deprecated
- Loading branch information
Showing
6 changed files
with
15 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,21 @@ | ||
require 'spec_helper' | ||
describe Hyrax::Actors::ActorStack do | ||
let(:user_or_ability) { create(:user) } | ||
let(:user) { create(:user) } | ||
let(:ability) { Ability.new(user) } | ||
|
||
let(:curation_concern) { GenericWork.new } | ||
let(:attributes) { {} } | ||
subject do | ||
described_class.new(curation_concern, | ||
user_or_ability, | ||
ability, | ||
[]) | ||
end | ||
|
||
context "when an ability is passed as the second argument" do | ||
let(:user_or_ability) { Ability.new(create(:user)) } | ||
it "assigns user to the ability's user" do | ||
expect(subject.user).to eq user_or_ability.current_user | ||
end | ||
it "delegates user to the ability" do | ||
expect(subject.user).to eq user | ||
end | ||
|
||
## Remove these specs when user support is removed. | ||
context "when a user is passed as the second argument" do | ||
let(:user_or_ability) { create(:user) } | ||
before do | ||
allow(Deprecation).to receive(:warn) | ||
end | ||
it "assigns user the user" do | ||
expect(subject.user).to eq user_or_ability | ||
end | ||
it "builds an ability" do | ||
expect(subject.ability.current_user).to eq user_or_ability | ||
end | ||
it "throws a deprecation warning" do | ||
expect(Deprecation).to have_received(:warn).with(subject, "Passing a user as an argument to Hyrax::Actors::ActorStack is deprecated, pass an Ability instead") | ||
end | ||
it "has ability" do | ||
expect(subject.ability).to eq ability | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters