Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
WillNigel23 committed Oct 17, 2024
1 parent bc96493 commit e4df608
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions spec/requests/article_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@
let(:action_path) { article_delete_path(article_id: article.id, collection_id: collection.id) }
let(:subject) { delete action_path }

context 'not authorized' do
it 'redirects' do
subject

expect(response).to have_http_status(:redirect)
expect(response).to redirect_to(dashboard_path)
end
end

context 'success' do
it 'redirects' do
login_as owner
Expand Down Expand Up @@ -78,6 +87,15 @@
let(:action_path) { collection_article_update_path(owner, collection, article) }
let(:subject) { patch action_path, params: params }

context 'not authorized' do
it 'redirects' do
subject

expect(response).to have_http_status(:redirect)
expect(response).to redirect_to(dashboard_path)
end
end

it 'redirects' do
login_as owner
subject
Expand Down Expand Up @@ -154,6 +172,15 @@
let(:action_path) { article_article_category_path(article_id: article.id) }
let(:subject) { post action_path, params: params }

context 'not authorized' do
it 'redirects' do
subject

expect(response).to have_http_status(:redirect)
expect(response).to redirect_to(dashboard_path)
end
end

it 'renders status' do
login_as owner
subject
Expand Down Expand Up @@ -185,6 +212,15 @@
let(:action_path) { article_combine_duplicate_path(article_id: to_article.id) }
let(:subject) { post action_path, params: params }

context 'not authorized' do
it 'redirects' do
subject

expect(response).to have_http_status(:redirect)
expect(response).to redirect_to(dashboard_path)
end
end

it 'redirects' do
login_as owner
subject
Expand Down

0 comments on commit e4df608

Please sign in to comment.