This repository was archived by the owner on Jul 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
[1339] hide announcement #1350
Merged
Merged
[1339] hide announcement #1350
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,4 +130,55 @@ | |
it_behaves_like 'access denied' | ||
end | ||
end | ||
context 'GET hide as' do | ||
shared_examples 'can hide announcement' do | ||
before do | ||
@announcement = FactoryGirl.create(:announcement) | ||
request.env['HTTP_REFERER'] = 'where_i_came_from' | ||
get :hide, id: @announcement | ||
end | ||
it 'should set some cookie values' do | ||
name = 'hidden_announcement_ids' | ||
jar = request.cookie_jar | ||
jar.signed[name] = [@announcement[:id].to_s] | ||
expect(response.cookies[name]).to eq(jar[name]) | ||
end | ||
end | ||
context 'superuser' do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's add "as" to the front of the string so it reads correctly, e.g. |
||
before do | ||
sign_in FactoryGirl.create(:superuser) | ||
end | ||
it_behaves_like 'can hide announcement' | ||
end | ||
context 'admin' do | ||
before do | ||
sign_in FactoryGirl.create(:admin) | ||
end | ||
it_behaves_like 'can hide announcement' | ||
end | ||
context 'patron' do | ||
before do | ||
sign_in FactoryGirl.create(:user) | ||
end | ||
it_behaves_like 'can hide announcement' | ||
end | ||
context 'checkout person' do | ||
before do | ||
sign_in FactoryGirl.create(:checkout_person) | ||
end | ||
it_behaves_like 'can hide announcement' | ||
end | ||
context 'guest' do | ||
before do | ||
sign_in FactoryGirl.create(:guest) | ||
end | ||
it_behaves_like 'can hide announcement' | ||
end | ||
context 'banned user' do | ||
before do | ||
sign_in FactoryGirl.create(:banned) | ||
end | ||
it_behaves_like 'can hide announcement' | ||
end | ||
end | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is unnecessary given line 47 below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed the redundancy but for some reason without that line checkout-person can't hide the announcement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, that's odd. I'll mess around and see if I can figure out why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the record, this is a separate issue and we'll deal with it in #1391