A platform for community discussion. Free, open, simple.
correct specs
Same806e6e96ffe
diff --git a/plugins/discourse-narrative-bot/spec/jobs/onceoff/remap_old_bot_iamges_spec.rb b/plugins/discourse-narrative-bot/spec/jobs/onceoff/remap_old_bot_iamges_spec.rbindex 31badd3612e..baba2beb384 100644--- a/plugins/discourse-narrative-bot/spec/jobs/onceoff/remap_old_bot_iamges_spec.rb+++ b/plugins/discourse-narrative-bot/spec/jobs/onceoff/remap_old_bot_iamges_spec.rb@@ -4,7 +4,7 @@ RSpec.describe Jobs::DiscourseNarrativeBot::RemapOldBotImages docontext "when bot's post contains an old link" dolet(:post) doFabricate(:post,- user_id: -2,+ user: User.find(-2),raw: 'If you’d like to learn more, select <img src="/images/font-awesome-gear.png" width="16" height="16"> <img src="/images/font-awesome-ellipsis.png" width="16" height="16"> below and <img src="/images/font-awesome-bookmark.png" width="16" height="16"> **bookmark this private message**. If you do, there may be a :gift: in your future!')end@@ -25,7 +25,7 @@ RSpec.describe Jobs::DiscourseNarrativeBot::RemapOldBotImages docontext 'subfolder' dolet(:post) doFabricate(:post,- user_id: -2,+ user: User.find(-2),raw: 'If you’d like to learn more, select <img src="/community/images/font-awesome-ellipsis.png" width="16" height="16"> below and <img src="/community/images/font-awesome-bookmark.png" width="16" height="16"> **bookmark this private message**. If you do, there may be a :gift: in your future!')enddiff --git a/plugins/poll/spec/controllers/polls_controller_spec.rb b/plugins/poll/spec/controllers/polls_controller_spec.rbindex 390d342f13b..7b97fcc6b43 100644--- a/plugins/poll/spec/controllers/polls_controller_spec.rb+++ b/plugins/poll/spec/controllers/polls_controller_spec.rb@@ -6,8 +6,8 @@ describe ::DiscoursePoll::PollsController dolet!(:user) { log_in }let(:topic) { Fabricate(:topic) }- let(:poll) { Fabricate(:post, topic_id: topic.id, user_id: user.id, raw: "[poll]\n- A\n- B\n[/poll]") }- let(:multi_poll) { Fabricate(:post, topic_id: topic.id, user_id: user.id, raw: "[poll min=1 max=2 type=multiple public=true]\n- A\n- B\n[/poll]") }+ let(:poll) { Fabricate(:post, topic: topic, user: user, raw: "[poll]\n- A\n- B\n[/poll]") }+ let(:multi_poll) { Fabricate(:post, topic: topic, user: user, raw: "[poll min=1 max=2 type=multiple public=true]\n- A\n- B\n[/poll]") }describe "#vote" do@@ -18,7 +18,7 @@ describe ::DiscoursePoll::PollsController dopost_id: poll.id, poll_name: "poll", options: ["5c24fc1df56d764b550ceae1b9319125"]}, format: :json- expect(response).to be_success+ expect(response.status).to eq(200)json = ::JSON.parse(response.body)expect(json["poll"]["name"]).to eq("poll")expect(json["poll"]["voters"]).to eq(1)@@ -30,7 +30,7 @@ describe ::DiscoursePoll::PollsController dopost_id: poll.id, poll_name: "poll", options: ["A", "B"]}, format: :json- expect(response).not_to be_success+ expect(response.status).not_to eq(200)json = ::JSON.parse(response.body)expect(json["errors"][0]).to eq(I18n.t("poll.requires_at_least_1_valid_option"))end@@ -40,13 +40,13 @@ describe ::DiscoursePoll::PollsController dopost_id: poll.id, poll_name: "poll", options: ["5c24fc1df56d764b550ceae1b9319125"]}, format: :json- expect(response).to be_success+ expect(response.status).to eq(200)put :vote, params: {post_id: poll.id, poll_name: "poll", options: ["e89dec30bbd9bf50fabf6a05b4324edf"]}, format: :json- expect(response).to be_success+ expect(response.status).to eq(200)json = ::JSON.parse(response.body)expect(json["poll"]["voters"]).to eq(1)expect(json["poll"]["options"][0]["votes"]).to eq(0)@@ -60,7 +60,7 @@ describe ::DiscoursePoll::PollsController dopost_id: poll.id, poll_name: "poll", options: ["5c24fc1df56d764b550ceae1b9319125"]}, format: :json- expect(response).to be_success+ expect(response.status).to eq(200)endit "ensures topic is not archived" do@@ -70,7 +70,7 @@ describe ::DiscoursePoll::PollsController dopost_id: poll.id, poll_name: "poll", options: ["A"]}, format: :json- expect(response).not_to be_success+ expect(response.status).not_to eq(200)json = ::JSON.parse(response.body)expect(json["errors"][0]).to eq(I18n.t("poll.topic_must_be_open_to_vote"))end@@ -82,7 +82,7 @@ describe ::DiscoursePoll::PollsController dopost_id: poll.id, poll_name: "poll", options: ["A"]}, format: :json- expect(response).not_to be_success+ expect(response.status).not_to eq(200)json = ::JSON.parse(response.body)expect(json["errors"][0]).to eq(I18n.t("poll.post_is_deleted"))end@@ -94,7 +94,7 @@ describe ::DiscoursePoll::PollsController dopost_id: poll.id, poll_name: "poll", options: ["A"]}, format: :json- expect(response).not_to be_success+ expect(response.status).not_to eq(200)json = ::JSON.parse(response.body)expect(json["errors"][0]).to eq(I18n.t("poll.user_cant_post_in_topic"))end@@ -104,7 +104,7 @@ describe ::DiscoursePoll::PollsController dopost_id: Fabricate(:post).id, poll_name: "foobar", options: ["A"]}, format: :json- expect(response).not_to be_success+ expect(response.status).not_to eq(200)json = ::JSON.parse(response.body)expect(json["errors"][0]).to eq(I18n.t("poll.no_polls_associated_with_this_post"))end@@ -114,7 +114,7 @@ describe ::DiscoursePoll::PollsController dopost_id: poll.id, poll_name: "foobar", options: ["A"]}, format: :json- expect(response).not_to be_success+ expect(response.status).not_to eq(200)json = ::JSON.parse(response.body)expect(json["errors"][0]).to eq(I18n.t("poll.no_poll_with_this_name", name: "foobar"))end@@ -126,7 +126,7 @@ describe ::DiscoursePoll::PollsController dopost_id: closed_poll.id, poll_name: "poll", options: ["5c24fc1df56d764b550ceae1b9319125"]}, format: :json- expect(response).not_to be_success+ expect(response.status).not_to eq(200)json = ::JSON.parse(response.body)expect(json["errors"][0]).to eq(I18n.t("poll.poll_must_be_open_to_vote"))end@@ -139,7 +139,7 @@ describe ::DiscoursePoll::PollsController dopost_id: poll.id, poll_name: "poll", options: ["5c24fc1df56d764b550ceae1b9319125"]}, format: :json- expect(response).to be_success+ expect(response.status).to eq(200)json = ::JSON.parse(response.body)expect(json["poll"]["voters"]).to eq(18)@@ -157,7 +157,7 @@ describe ::DiscoursePoll::PollsController doformat: :jsonend.first- expect(response).to be_success+ expect(response.status).to eq(200)json = ::JSON.parse(response.body)expect(json["poll"]["voters"]).to eq(1)@@ -172,7 +172,7 @@ describe ::DiscoursePoll::PollsController doparams: body.merge(options: ["e89dec30bbd9bf50fabf6a05b4324edf"]),format: :json- expect(response).to be_success+ expect(response.status).to eq(200)json = ::JSON.parse(response.body)expect(json["poll"]["voters"]).to eq(1)@@ -188,7 +188,7 @@ describe ::DiscoursePoll::PollsController doparams: body.merge(options: ["e89dec30bbd9bf50fabf6a05b4324edf", "5c24fc1df56d764b550ceae1b9319125"]),format: :json- expect(response).to be_success+ expect(response.status).to eq(200)json = ::JSON.parse(response.body)expect(json["poll"]["voters"]).to eq(2)@@ -208,7 +208,7 @@ describe ::DiscoursePoll::PollsController dopost_id: poll.id, poll_name: "poll", status: "closed"}, format: :json- expect(response).to be_success+ expect(response.status).to eq(200)json = ::JSON.parse(response.body)expect(json["poll"]["status"]).to eq("closed")end@@ -221,7 +221,7 @@ describe ::DiscoursePoll::PollsController dopost_id: poll.id, poll_name: "poll", status: "closed"}, format: :json- expect(response).to be_success+ expect(response.status).to eq(200)json = ::JSON.parse(response.body)expect(json["poll"]["status"]).to eq("closed")end@@ -233,7 +233,7 @@ describe ::DiscoursePoll::PollsController dopost_id: poll.id, poll_name: "poll", status: "closed"}, format: :json- expect(response).not_to be_success+ expect(response.status).not_to eq(200)json = ::JSON.parse(response.body)expect(json["errors"][0]).to eq(I18n.t("poll.post_is_deleted"))end@@ -253,7 +253,7 @@ describe ::DiscoursePoll::PollsController dopost_id: multi_poll.id, poll_name: "poll", options: [first]}, format: :json- expect(response).to be_success+ expect(response.status).to eq(200)user2 = log_in@@ -261,7 +261,7 @@ describe ::DiscoursePoll::PollsController dopost_id: multi_poll.id, poll_name: "poll", options: [first]}, format: :json- expect(response).to be_success+ expect(response.status).to eq(200)user3 = log_in@@ -271,13 +271,13 @@ describe ::DiscoursePoll::PollsController dooptions: [first, second]}, format: :json- expect(response).to be_success+ expect(response.status).to eq(200)get :voters, params: {poll_name: 'poll', post_id: multi_poll.id, voter_limit: 2}, format: :json- expect(response).to be_success+ expect(response.status).to eq(200)json = JSON.parse(response.body)