remove elder terminology in specs
This commit is contained in:
parent
8b634b5f0f
commit
e3f7d2a3ac
|
@ -7,8 +7,8 @@ describe Guardian do
|
||||||
let(:user) { build(:user) }
|
let(:user) { build(:user) }
|
||||||
let(:moderator) { build(:moderator) }
|
let(:moderator) { build(:moderator) }
|
||||||
let(:admin) { build(:admin) }
|
let(:admin) { build(:admin) }
|
||||||
let(:leader) { build(:user, trust_level: 3) }
|
let(:trust_level_3) { build(:user, trust_level: 3) }
|
||||||
let(:elder) { build(:user, trust_level: 4) }
|
let(:trust_level_4) { build(:user, trust_level: 4) }
|
||||||
let(:another_admin) { build(:admin) }
|
let(:another_admin) { build(:admin) }
|
||||||
let(:coding_horror) { build(:coding_horror) }
|
let(:coding_horror) { build(:coding_horror) }
|
||||||
|
|
||||||
|
@ -426,11 +426,11 @@ describe Guardian do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'is true for trust level 4' do
|
it 'is true for trust level 4' do
|
||||||
Guardian.new(Fabricate(:elder)).can_see?(post_revision).should == true
|
Guardian.new(trust_level_4).can_see?(post_revision).should == true
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'is false for trust level lower than 4' do
|
it 'is false for trust level lower than 4' do
|
||||||
Guardian.new(Fabricate(:leader)).can_see?(post_revision).should == false
|
Guardian.new(trust_level_3).can_see?(post_revision).should == false
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'is true if the author has public edit history' do
|
it 'is true if the author has public edit history' do
|
||||||
|
@ -535,8 +535,8 @@ describe Guardian do
|
||||||
Guardian.new(admin).can_create?(Post, topic).should be_true
|
Guardian.new(admin).can_create?(Post, topic).should be_true
|
||||||
end
|
end
|
||||||
|
|
||||||
it "allows new posts from elders" do
|
it "allows new posts from trust_level_4s" do
|
||||||
Guardian.new(elder).can_create?(Post, topic).should be_true
|
Guardian.new(trust_level_4).can_create?(Post, topic).should be_true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -756,7 +756,7 @@ describe Guardian do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns true as a trust level 4 user' do
|
it 'returns true as a trust level 4 user' do
|
||||||
Guardian.new(elder).can_edit?(post).should be_true
|
Guardian.new(trust_level_4).can_edit?(post).should be_true
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'post is older than post_edit_time_limit' do
|
context 'post is older than post_edit_time_limit' do
|
||||||
|
@ -849,7 +849,7 @@ describe Guardian do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns true at trust level 3' do
|
it 'returns true at trust level 3' do
|
||||||
Guardian.new(leader).can_edit?(topic).should eq(true)
|
Guardian.new(trust_level_3).can_edit?(topic).should eq(true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -863,7 +863,7 @@ describe Guardian do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns true at trust level 3' do
|
it 'returns true at trust level 3' do
|
||||||
Guardian.new(leader).can_edit?(build(:topic, user: user, archived: true)).should == true
|
Guardian.new(trust_level_3).can_edit?(build(:topic, user: user, archived: true)).should == true
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns false as a topic creator' do
|
it 'returns false as a topic creator' do
|
||||||
|
@ -943,7 +943,7 @@ describe Guardian do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns true when trust level 4' do
|
it 'returns true when trust level 4' do
|
||||||
Guardian.new(elder).can_moderate?(topic).should be_true
|
Guardian.new(trust_level_4).can_moderate?(topic).should be_true
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -1840,8 +1840,8 @@ describe Guardian do
|
||||||
Guardian.new(admin).can_wiki?.should be_true
|
Guardian.new(admin).can_wiki?.should be_true
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns true for elder user' do
|
it 'returns true for trust_level_4 user' do
|
||||||
Guardian.new(elder).can_wiki?.should be_true
|
Guardian.new(trust_level_4).can_wiki?.should be_true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -54,7 +54,7 @@ describe InvitesController do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "fails for normal user if invite email already exists" do
|
it "fails for normal user if invite email already exists" do
|
||||||
user = log_in(:elder)
|
user = log_in(:trust_level_4)
|
||||||
invite = Invite.invite_by_email("invite@example.com", user)
|
invite = Invite.invite_by_email("invite@example.com", user)
|
||||||
invite.reload
|
invite.reload
|
||||||
post :create, email: invite.email
|
post :create, email: invite.email
|
||||||
|
|
|
@ -537,7 +537,7 @@ describe PostsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "ensures trust level 4 can see the revisions" do
|
it "ensures trust level 4 can see the revisions" do
|
||||||
log_in(:elder)
|
log_in(:trust_level_4)
|
||||||
xhr :get, :revisions, post_id: post_revision.post_id, revision: post_revision.number
|
xhr :get, :revisions, post_id: post_revision.post_id, revision: post_revision.number
|
||||||
response.should be_success
|
response.should be_success
|
||||||
end
|
end
|
||||||
|
|
|
@ -208,8 +208,8 @@ describe TopicsController do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'forbidden to elders' do
|
describe 'forbidden to trust_level_4s' do
|
||||||
let!(:elder) { log_in(:elder) }
|
let!(:trust_level_4) { log_in(:trust_level_4) }
|
||||||
|
|
||||||
it 'correctly denies' do
|
it 'correctly denies' do
|
||||||
xhr :post, :change_post_owners, topic_id: 111, username: 'user_a', post_ids: [1,2,3]
|
xhr :post, :change_post_owners, topic_id: 111, username: 'user_a', post_ids: [1,2,3]
|
||||||
|
|
|
@ -73,9 +73,9 @@ Fabricator(:leader, from: :user) do
|
||||||
trust_level TrustLevel[3]
|
trust_level TrustLevel[3]
|
||||||
end
|
end
|
||||||
|
|
||||||
Fabricator(:elder, from: :user) do
|
Fabricator(:trust_level_4, from: :user) do
|
||||||
name 'Elder McElderson'
|
name 'Leader McElderson'
|
||||||
username { sequence(:username) { |i| "elder#{i}" } }
|
username { sequence(:username) { |i| "tl4#{i}" } }
|
||||||
email { sequence(:email) { |i| "elder#{i}@elderfun.com" } }
|
email { sequence(:email) { |i| "tl4#{i}@elderfun.com" } }
|
||||||
trust_level TrustLevel[4]
|
trust_level TrustLevel[4]
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue