Improve specs.
This commit is contained in:
parent
651015fb9b
commit
2baff71518
|
@ -362,7 +362,6 @@ RSpec.describe TopicsController do
|
||||||
|
|
||||||
it 'requires an email parameter' do
|
it 'requires an email parameter' do
|
||||||
post "/t/#{topic.id}/invite.json"
|
post "/t/#{topic.id}/invite.json"
|
||||||
|
|
||||||
expect(response.status).to eq(400)
|
expect(response.status).to eq(400)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -472,14 +471,14 @@ RSpec.describe TopicsController do
|
||||||
let(:moderator) { Fabricate(:moderator) }
|
let(:moderator) { Fabricate(:moderator) }
|
||||||
|
|
||||||
it "fails for anonymous users" do
|
it "fails for anonymous users" do
|
||||||
put "/t/#{topic.id}/publish.json", params: { category_id: category.id }
|
put "/t/#{topic.id}/publish.json", params: { destination_category_id: category.id }
|
||||||
expect(response).not_to be_success
|
expect(response.status).to eq(403)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "fails as a regular user" do
|
it "fails as a regular user" do
|
||||||
sign_in(Fabricate(:user))
|
sign_in(Fabricate(:user))
|
||||||
put "/t/#{topic.id}/publish.json", params: { category_id: category.id }
|
put "/t/#{topic.id}/publish.json", params: { destination_category_id: category.id }
|
||||||
expect(response).not_to be_success
|
expect(response.status).to eq(403)
|
||||||
end
|
end
|
||||||
|
|
||||||
context "as staff" do
|
context "as staff" do
|
||||||
|
@ -489,7 +488,7 @@ RSpec.describe TopicsController do
|
||||||
|
|
||||||
it "will publish the topic" do
|
it "will publish the topic" do
|
||||||
put "/t/#{topic.id}/publish.json", params: { destination_category_id: category.id }
|
put "/t/#{topic.id}/publish.json", params: { destination_category_id: category.id }
|
||||||
expect(response).to be_success
|
expect(response.status).to eq(200)
|
||||||
json = ::JSON.parse(response.body)['basic_topic']
|
json = ::JSON.parse(response.body)['basic_topic']
|
||||||
|
|
||||||
result = Topic.find(json['id'])
|
result = Topic.find(json['id'])
|
||||||
|
|
Loading…
Reference in New Issue