mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Assert for 200 response code to avoid changing magic helper in the future.
This commit is contained in:
@@ -21,7 +21,7 @@ RSpec.describe Admin::BackupsController do
|
||||
|
||||
post "/admin/backups/rollback.json"
|
||||
|
||||
expect(response).to be_successful
|
||||
expect(response.status).to eq(200)
|
||||
end
|
||||
|
||||
it 'should not allow rollback via a GET request' do
|
||||
@@ -36,7 +36,7 @@ RSpec.describe Admin::BackupsController do
|
||||
|
||||
delete "/admin/backups/cancel.json"
|
||||
|
||||
expect(response).to be_successful
|
||||
expect(response.status).to eq(200)
|
||||
end
|
||||
|
||||
it 'should not allow cancel via a GET request' do
|
||||
@@ -59,7 +59,7 @@ RSpec.describe Admin::BackupsController do
|
||||
|
||||
put "/admin/backups/#{backup_filename}.json"
|
||||
|
||||
expect(response).to be_successful
|
||||
expect(response.status).to eq(200)
|
||||
end
|
||||
|
||||
it "returns 404 when the backup does not exist" do
|
||||
|
||||
@@ -33,7 +33,7 @@ RSpec.describe Admin::EmailTemplatesController do
|
||||
sign_in(admin)
|
||||
get '/admin/customize/email_templates.json'
|
||||
|
||||
expect(response).to be_successful
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
json = ::JSON.parse(response.body)
|
||||
expect(json['email_templates']).to be_present
|
||||
@@ -169,7 +169,7 @@ RSpec.describe Admin::EmailTemplatesController do
|
||||
email_template: { subject: email_subject, body: email_body }
|
||||
}, headers: headers
|
||||
|
||||
expect(response).to be_successful
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
json = ::JSON.parse(response.body)
|
||||
expect(json).to be_present
|
||||
@@ -265,7 +265,7 @@ RSpec.describe Admin::EmailTemplatesController do
|
||||
|
||||
it "returns the restored email template" do
|
||||
delete '/admin/customize/email_templates/user_notifications.admin_login', headers: headers
|
||||
expect(response).to be_successful
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
json = ::JSON.parse(response.body)
|
||||
expect(json).to be_present
|
||||
|
||||
@@ -6,7 +6,7 @@ RSpec.describe Admin::FlaggedTopicsController do
|
||||
shared_examples "successfully retrieve list of flagged topics" do
|
||||
it "returns a list of flagged topics" do
|
||||
get "/admin/flagged_topics.json"
|
||||
expect(response).to be_successful
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
data = ::JSON.parse(response.body)
|
||||
expect(data['flagged_topics']).to be_present
|
||||
|
||||
@@ -13,7 +13,7 @@ RSpec.describe Admin::FlagsController do
|
||||
it 'should return the right response when nothing is flagged' do
|
||||
get '/admin/flags.json'
|
||||
|
||||
expect(response).to be_successful
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
data = ::JSON.parse(response.body)
|
||||
expect(data["users"]).to eq([])
|
||||
@@ -25,7 +25,7 @@ RSpec.describe Admin::FlagsController do
|
||||
|
||||
get '/admin/flags.json'
|
||||
|
||||
expect(response).to be_successful
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
data = ::JSON.parse(response.body)
|
||||
expect(data["users"].length).to eq(2)
|
||||
|
||||
@@ -22,7 +22,7 @@ RSpec.describe Admin::BackupsController do
|
||||
describe "for a post" do
|
||||
it "returns an empty array when the post doesn't exist" do
|
||||
get "/admin/moderation_history.json?filter=post&post_id=99999999"
|
||||
expect(response).to be_successful
|
||||
expect(response.status).to eq(200)
|
||||
expect(::JSON.parse(response.body)['moderation_history']).to be_blank
|
||||
end
|
||||
|
||||
@@ -31,7 +31,7 @@ RSpec.describe Admin::BackupsController do
|
||||
p = Fabricate(:post, topic: p.topic)
|
||||
PostDestroyer.new(Discourse.system_user, p).destroy
|
||||
get "/admin/moderation_history.json?filter=post&post_id=#{p.id}"
|
||||
expect(response).to be_successful
|
||||
expect(response.status).to eq(200)
|
||||
expect(::JSON.parse(response.body)['moderation_history']).to be_present
|
||||
end
|
||||
|
||||
@@ -40,7 +40,7 @@ RSpec.describe Admin::BackupsController do
|
||||
describe "for a topic" do
|
||||
it "returns empty history when the topic doesn't exist" do
|
||||
get "/admin/moderation_history.json?filter=topic&topic_id=1234"
|
||||
expect(response).to be_successful
|
||||
expect(response.status).to eq(200)
|
||||
expect(::JSON.parse(response.body)['moderation_history']).to be_blank
|
||||
end
|
||||
|
||||
@@ -48,7 +48,7 @@ RSpec.describe Admin::BackupsController do
|
||||
p = Fabricate(:post)
|
||||
PostDestroyer.new(Discourse.system_user, p).destroy
|
||||
get "/admin/moderation_history.json?filter=topic&topic_id=#{p.topic_id}"
|
||||
expect(response).to be_successful
|
||||
expect(response.status).to eq(200)
|
||||
expect(::JSON.parse(response.body)['moderation_history']).to be_present
|
||||
end
|
||||
end
|
||||
|
||||
@@ -28,7 +28,7 @@ RSpec.describe Admin::SearchLogsController do
|
||||
sign_in(admin)
|
||||
get '/admin/logs/search_logs.json'
|
||||
|
||||
expect(response).to be_successful
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
json = ::JSON.parse(response.body)
|
||||
expect(json[0]['term']).to eq('ruby')
|
||||
@@ -51,7 +51,7 @@ RSpec.describe Admin::SearchLogsController do
|
||||
sign_in(admin)
|
||||
get '/admin/logs/search_logs/term/ruby.json'
|
||||
|
||||
expect(response).to be_successful
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
json = ::JSON.parse(response.body)
|
||||
expect(json['term']['type']).to eq('search_log_term')
|
||||
|
||||
Reference in New Issue
Block a user