... @@ -56,7 +56,7 @@ describe SentNotificationsController do
... @@ -56,7 +56,7 @@ describe SentNotificationsController do
get ( :unsubscribe , params: { id: sent_notification . reply_key })
get ( :unsubscribe , params: { id: sent_notification . reply_key })
end
end
shared_examples 'unsubscribing as anonymous' do
shared_examples 'unsubscribing as anonymous' do | project_visibility |
it 'does not unsubscribe the user' do
it 'does not unsubscribe the user' do
expect ( noteable . subscribed? ( user , target_project )). to be_truthy
expect ( noteable . subscribed? ( user , target_project )). to be_truthy
end
end
... @@ -69,6 +69,18 @@ describe SentNotificationsController do
... @@ -69,6 +69,18 @@ describe SentNotificationsController do
expect ( response . status ). to eq ( 200 )
expect ( response . status ). to eq ( 200 )
expect ( response ). to render_template :unsubscribe
expect ( response ). to render_template :unsubscribe
end
end
if project_visibility == :private
it 'does not show project name or path' do
expect ( response . body ). not_to include ( noteable . project . name )
expect ( response . body ). not_to include ( noteable . project . full_name )
end
else
it 'shows project name or path' do
expect ( response . body ). to include ( noteable . project . name )
expect ( response . body ). to include ( noteable . project . full_name )
end
end
end
end
context 'when project is public' do
context 'when project is public' do
... @@ -79,7 +91,7 @@ describe SentNotificationsController do
... @@ -79,7 +91,7 @@ describe SentNotificationsController do
expect ( response . body ). to include ( issue . title )
expect ( response . body ). to include ( issue . title )
end
end
it_behaves_like 'unsubscribing as anonymous'
it_behaves_like 'unsubscribing as anonymous' , :public
end
end
context 'when unsubscribing from confidential issue' do
context 'when unsubscribing from confidential issue' do
... @@ -90,7 +102,7 @@ describe SentNotificationsController do
... @@ -90,7 +102,7 @@ describe SentNotificationsController do
expect ( response . body ). to include ( confidential_issue . to_reference )
expect ( response . body ). to include ( confidential_issue . to_reference )
end
end
it_behaves_like 'unsubscribing as anonymous'
it_behaves_like 'unsubscribing as anonymous' , :public
end
end
context 'when unsubscribing from merge request' do
context 'when unsubscribing from merge request' do
... @@ -100,7 +112,12 @@ describe SentNotificationsController do
... @@ -100,7 +112,12 @@ describe SentNotificationsController do
expect ( response . body ). to include ( merge_request . title )
expect ( response . body ). to include ( merge_request . title )
end
end
it_behaves_like 'unsubscribing as anonymous'
it 'shows project name or path' do
expect ( response . body ). to include ( issue . project . name )
expect ( response . body ). to include ( issue . project . full_name )
end
it_behaves_like 'unsubscribing as anonymous' , :public
end
end
end
end
... @@ -110,11 +127,11 @@ describe SentNotificationsController do
... @@ -110,11 +127,11 @@ describe SentNotificationsController do
context 'when unsubscribing from issue' do
context 'when unsubscribing from issue' do
let ( :noteable ) { issue }
let ( :noteable ) { issue }
it 'shows issue title' do
it 'does not show issue title' do
expect ( response . body ). not_to include ( issue . title )
expect ( response . body ). not_to include ( issue . title )
end
end
it_behaves_like 'unsubscribing as anonymous'
it_behaves_like 'unsubscribing as anonymous' , :private
end
end
context 'when unsubscribing from confidential issue' do
context 'when unsubscribing from confidential issue' do
... @@ -125,17 +142,17 @@ describe SentNotificationsController do
... @@ -125,17 +142,17 @@ describe SentNotificationsController do
expect ( response . body ). to include ( confidential_issue . to_reference )
expect ( response . body ). to include ( confidential_issue . to_reference )
end
end
it_behaves_like 'unsubscribing as anonymous'
it_behaves_like 'unsubscribing as anonymous' , :private
end
end
context 'when unsubscribing from merge request' do
context 'when unsubscribing from merge request' do
let ( :noteable ) { merge_request }
let ( :noteable ) { merge_request }
it 'shows merge request title' do
it 'dos not show merge request title' do
expect ( response . body ). not_to include ( merge_request . title )
expect ( response . body ). not_to include ( merge_request . title )
end
end
it_behaves_like 'unsubscribing as anonymous'
it_behaves_like 'unsubscribing as anonymous' , :private
end
end
end
end
end
end
...
...
... ...