mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
update specs to remove deprecation warnings
This commit is contained in:
@@ -39,7 +39,7 @@ describe SpamRulesEnforcer do
|
||||
|
||||
When { PostAction.act(user2, spam_post, PostActionType.types[:spam]) }
|
||||
|
||||
Invariant { expect(Guardian.new(spammer).can_create_topic?(nil)).should == false }
|
||||
Invariant { expect(Guardian.new(spammer).can_create_topic?(nil)).to be false }
|
||||
Invariant { expect{PostCreator.create(spammer, {title: 'limited time offer for you', raw: 'better buy this stuff ok', archetype_id: 1})}.to raise_error(Discourse::InvalidAccess) }
|
||||
Invariant { expect{PostCreator.create(spammer, {topic_id: another_topic.id, raw: 'my reply is spam in your topic', archetype_id: 1})}.to raise_error(Discourse::InvalidAccess) }
|
||||
|
||||
@@ -73,7 +73,7 @@ describe SpamRulesEnforcer do
|
||||
Given { SiteSetting.stubs(:flags_required_to_hide_post).returns(2) }
|
||||
When { PostAction.act(user2, spam_post, PostActionType.types[:spam]) }
|
||||
Then { expect(spammer.reload).to be_blocked }
|
||||
And { expect(Guardian.new(spammer).can_create_topic?(nil)).should == false }
|
||||
And { expect(Guardian.new(spammer).can_create_topic?(nil)).to be false }
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -87,7 +87,7 @@ describe SpamRulesEnforcer do
|
||||
When { PostAction.act(user1, spam_post, PostActionType.types[:spam]) }
|
||||
When { PostAction.act(user2, spam_post, PostActionType.types[:spam]) }
|
||||
Then { expect(spam_post.reload).to_not be_hidden }
|
||||
And { expect(Guardian.new(spammer).can_create_topic?(nil)).should == true }
|
||||
And { expect(Guardian.new(spammer).can_create_topic?(nil)).to be true }
|
||||
And { expect{PostCreator.create(spammer, {title: 'limited time offer for you', raw: 'better buy this stuff ok', archetype_id: 1})}.to_not raise_error }
|
||||
And { expect(spammer.reload.private_topics_count).to eq(private_messages_count) }
|
||||
end
|
||||
|
||||
@@ -53,13 +53,13 @@ describe Topic do
|
||||
Given(:category) { Fabricate(:category, auto_close_hours: 2.0) }
|
||||
Then { topic.auto_close_at.should be_within_one_second_of(2.hours.from_now) }
|
||||
And { topic.auto_close_started_at.should == Time.zone.now }
|
||||
And { scheduled_jobs_for(:close_topic, {topic_id: topic.id}).should have(1).job }
|
||||
And { scheduled_jobs_for(:close_topic, {topic_id: topic.id}).size.should == 1 }
|
||||
And { scheduled_jobs_for(:close_topic, {topic_id: category.topic.id}).should be_empty }
|
||||
|
||||
context 'topic was created by staff user' do
|
||||
Given(:admin) { Fabricate(:admin) }
|
||||
Given(:staff_topic) { Fabricate(:topic, user: admin, category: category) }
|
||||
Then { scheduled_jobs_for(:close_topic, {topic_id: staff_topic.id, user_id: admin.id}).should have(1).job }
|
||||
Then { scheduled_jobs_for(:close_topic, {topic_id: staff_topic.id, user_id: admin.id}).size.should == 1 }
|
||||
|
||||
context 'topic is closed manually' do
|
||||
When { staff_topic.update_status('closed', true, admin) }
|
||||
@@ -73,7 +73,7 @@ describe Topic do
|
||||
Given { Discourse.stubs(:system_user).returns(system_user) }
|
||||
Given(:regular_user) { Fabricate(:user) }
|
||||
Given(:regular_user_topic) { Fabricate(:topic, user: regular_user, category: category) }
|
||||
Then { scheduled_jobs_for(:close_topic, {topic_id: regular_user_topic.id, user_id: system_user.id}).should have(1).job }
|
||||
Then { scheduled_jobs_for(:close_topic, {topic_id: regular_user_topic.id, user_id: system_user.id}).size.should == 1 }
|
||||
end
|
||||
|
||||
context 'auto_close_hours of topic was set to 0' do
|
||||
@@ -84,7 +84,7 @@ describe Topic do
|
||||
context 'two topics in the category' do
|
||||
Given!(:other_topic) { Fabricate(:topic, category: category) }
|
||||
When { topic } # create the second topic
|
||||
Then { scheduled_jobs_for(:close_topic).should have(2).jobs }
|
||||
Then { scheduled_jobs_for(:close_topic).size.should == 2 }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user