mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 21:55:25 +08:00
DEV: Use proper wording for contexts in specs
This commit is contained in:

committed by
Loïc Guitaut

parent
02987e05d5
commit
3eaac56797
@ -103,7 +103,7 @@ RSpec.describe "DiscoursePoll endpoints" do
|
||||
end
|
||||
end
|
||||
|
||||
context "number poll" do
|
||||
context "with number poll" do
|
||||
let(:post) { Fabricate(:post, raw: "[poll type=number min=1 max=20 step=1 public=true]\n[/poll]") }
|
||||
|
||||
it 'should return the right response' do
|
||||
|
@ -3,7 +3,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe Admin::UsersController do
|
||||
|
||||
let(:admin) { Fabricate(:admin) }
|
||||
|
||||
before { sign_in(admin) }
|
||||
@ -11,7 +10,7 @@ RSpec.describe Admin::UsersController do
|
||||
describe '#destroy' do
|
||||
let(:delete_me) { Fabricate(:user) }
|
||||
|
||||
context "user has voted" do
|
||||
context "when user has voted" do
|
||||
let!(:topic) { Fabricate(:topic, user: admin) }
|
||||
let!(:post) { Fabricate(:post, topic: topic, user: admin, raw: "[poll]\n- a\n- b\n[/poll]") }
|
||||
|
||||
@ -26,5 +25,4 @@ RSpec.describe Admin::UsersController do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -16,10 +16,10 @@ RSpec.describe PollOptionSerializer do
|
||||
poll.poll_votes.create!(poll_option_id: poll.poll_options.first.id, user_id: voter.id)
|
||||
end
|
||||
|
||||
context 'poll results are public' do
|
||||
context 'when poll results are public' do
|
||||
let(:post) { Fabricate(:post, raw: "[poll]\n- A\n- B\n[/poll]") }
|
||||
|
||||
context 'user is not staff' do
|
||||
context 'when user is not staff' do
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
||||
it 'include votes' do
|
||||
@ -30,10 +30,10 @@ RSpec.describe PollOptionSerializer do
|
||||
end
|
||||
end
|
||||
|
||||
context 'poll results are staff only' do
|
||||
context 'when poll results are staff only' do
|
||||
let(:post) { Fabricate(:post, raw: "[poll results=staff_only]\n- A\n- B\n[/poll]") }
|
||||
|
||||
context 'user is not staff' do
|
||||
context 'when user is not staff' do
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
||||
it 'doesn’t include votes' do
|
||||
@ -43,7 +43,7 @@ RSpec.describe PollOptionSerializer do
|
||||
end
|
||||
end
|
||||
|
||||
context 'user staff' do
|
||||
context 'when user is staff' do
|
||||
let(:admin) { Fabricate(:admin) }
|
||||
|
||||
it 'includes votes' do
|
||||
|
Reference in New Issue
Block a user