From 2baff7151801b9953ebe1a046cd638c1c34cdfa1 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Wed, 21 Mar 2018 08:33:06 +0800 Subject: [PATCH] Improve specs. --- spec/requests/topics_controller_spec.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/spec/requests/topics_controller_spec.rb b/spec/requests/topics_controller_spec.rb index a9f43be6fa2..646a926e3af 100644 --- a/spec/requests/topics_controller_spec.rb +++ b/spec/requests/topics_controller_spec.rb @@ -362,7 +362,6 @@ RSpec.describe TopicsController do it 'requires an email parameter' do post "/t/#{topic.id}/invite.json" - expect(response.status).to eq(400) end @@ -472,14 +471,14 @@ RSpec.describe TopicsController do let(:moderator) { Fabricate(:moderator) } it "fails for anonymous users" do - put "/t/#{topic.id}/publish.json", params: { category_id: category.id } - expect(response).not_to be_success + put "/t/#{topic.id}/publish.json", params: { destination_category_id: category.id } + expect(response.status).to eq(403) end it "fails as a regular user" do sign_in(Fabricate(:user)) - put "/t/#{topic.id}/publish.json", params: { category_id: category.id } - expect(response).not_to be_success + put "/t/#{topic.id}/publish.json", params: { destination_category_id: category.id } + expect(response.status).to eq(403) end context "as staff" do @@ -489,7 +488,7 @@ RSpec.describe TopicsController do it "will publish the topic" do 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'] result = Topic.find(json['id'])