Skip to content
This repository was archived by the owner on Jul 24, 2020. It is now read-only.

Commit d4f5021

Browse files
committed
Fixed some naming convensions and rearranged shared examples
1 parent 57b06ff commit d4f5021

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

spec/controllers/announcements_controller_spec.rb

+15-18
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,6 @@
1515
@app_config = FactoryGirl.create(:app_config)
1616
end
1717

18-
shared_examples 'can hide announcement' do
19-
before do
20-
@announcement = FactoryGirl.create(:announcement)
21-
@attributes = FactoryGirl.attributes_for(:announcement)
22-
request.env['HTTP_REFERER'] = 'where_i_came_from'
23-
get :hide, id: @announcement
24-
end
25-
it 'should set some cookie values' do
26-
name = 'hidden_announcement_ids'
27-
jar = request.cookie_jar
28-
jar.signed[name] = [@announcement[:id].to_s]
29-
expect(response.cookies[name]).to eq(jar[name])
30-
end
31-
end
32-
3318
describe 'with admin' do
3419
before do
3520
sign_in FactoryGirl.create(:admin)
@@ -145,8 +130,20 @@
145130
it_behaves_like 'access denied'
146131
end
147132
end
148-
context 'check hide' do
149-
before { @announcement = FactoryGirl.create(:announcement) }
133+
context 'GET hide as' do
134+
shared_examples 'can hide announcement' do
135+
before do
136+
@announcement = FactoryGirl.create(:announcement)
137+
request.env['HTTP_REFERER'] = 'where_i_came_from'
138+
get :hide, id: @announcement
139+
end
140+
it 'should set some cookie values' do
141+
name = 'hidden_announcement_ids'
142+
jar = request.cookie_jar
143+
jar.signed[name] = [@announcement[:id].to_s]
144+
expect(response.cookies[name]).to eq(jar[name])
145+
end
146+
end
150147
context 'superuser' do
151148
before do
152149
sign_in FactoryGirl.create(:superuser)
@@ -171,7 +168,7 @@
171168
end
172169
it_behaves_like 'can hide announcement'
173170
end
174-
context 'geust' do
171+
context 'guest' do
175172
before do
176173
sign_in FactoryGirl.create(:guest)
177174
end

0 commit comments

Comments
 (0)