update specs to remove deprecation warnings
This commit is contained in:
parent
067f552cd5
commit
efc4109902
|
@ -73,7 +73,7 @@ describe CategoryList do
|
|||
SiteSetting.stubs(:allow_uncategorized_topics).returns(true)
|
||||
Fabricate(:topic, category: Fabricate(:category))
|
||||
Guardian.any_instance.expects(:can_create?).with(Category).returns(true)
|
||||
category_list.categories.should have(3).categories
|
||||
category_list.categories.size.should == 3
|
||||
category_list.categories.should include(topic_category)
|
||||
end
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ describe Admin::DashboardController do
|
|||
it 'returns an empty array' do
|
||||
xhr :get, :problems
|
||||
json = JSON.parse(response.body)
|
||||
json['problems'].should have(0).problems
|
||||
json['problems'].size.should == 0
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -72,7 +72,7 @@ describe Admin::DashboardController do
|
|||
it 'returns an array of strings' do
|
||||
xhr :get, :problems
|
||||
json = JSON.parse(response.body)
|
||||
json['problems'].should have(2).problems
|
||||
json['problems'].size.should == 2
|
||||
json['problems'][0].should be_a(String)
|
||||
json['problems'][1].should be_a(String)
|
||||
end
|
||||
|
|
|
@ -782,7 +782,7 @@ describe UsersController do
|
|||
xhr :get, :invited, username: inviter.username, filter: 'billybob'
|
||||
|
||||
invites = JSON.parse(response.body)['invites']
|
||||
expect(invites).to have(1).item
|
||||
invites.size.should == 1
|
||||
expect(invites.first).to include('email' => 'billybob@example.com')
|
||||
end
|
||||
|
||||
|
@ -804,7 +804,7 @@ describe UsersController do
|
|||
xhr :get, :invited, username: inviter.username, filter: 'billybob'
|
||||
|
||||
invites = JSON.parse(response.body)['invites']
|
||||
expect(invites).to have(1).item
|
||||
invites.size.should == 1
|
||||
expect(invites.first).to include('email' => 'billybob@example.com')
|
||||
end
|
||||
|
||||
|
@ -830,7 +830,7 @@ describe UsersController do
|
|||
xhr :get, :invited, username: inviter.username
|
||||
|
||||
invites = JSON.parse(response.body)['invites']
|
||||
expect(invites).to have(1).item
|
||||
invites.size.should == 1
|
||||
expect(invites.first).to include('email' => invite.email)
|
||||
end
|
||||
end
|
||||
|
@ -851,7 +851,7 @@ describe UsersController do
|
|||
xhr :get, :invited, username: inviter.username
|
||||
|
||||
invites = JSON.parse(response.body)['invites']
|
||||
expect(invites).to have(1).item
|
||||
invites.size.should == 1
|
||||
expect(invites.first).to include("email" => invite.email)
|
||||
end
|
||||
end
|
||||
|
@ -885,7 +885,7 @@ describe UsersController do
|
|||
xhr :get, :invited, username: inviter.username
|
||||
|
||||
invites = JSON.parse(response.body)['invites']
|
||||
expect(invites).to have(1).item
|
||||
invites.size.should == 1
|
||||
expect(invites.first).to include('email' => invite.email)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ describe ColorScheme do
|
|||
describe "new" do
|
||||
it "can take colors" do
|
||||
c = described_class.new(valid_params)
|
||||
c.colors.should have(valid_colors.size).colors
|
||||
c.colors.size.should == valid_colors.size
|
||||
c.colors.first.should be_a(ColorSchemeColor)
|
||||
expect {
|
||||
c.save.should == true
|
||||
|
@ -32,7 +32,7 @@ describe ColorScheme do
|
|||
|
||||
it "creates a new color scheme" do
|
||||
c = described_class.create_from_base(name: 'Yellow', colors: {first_one: 'FFFF00', third_one: 'F00D33'})
|
||||
c.colors.should have(base_colors.size).colors
|
||||
c.colors.size.should == base_colors.size
|
||||
first = c.colors.find {|x| x.name == 'first_one'}
|
||||
second = c.colors.find {|x| x.name == 'second_one'}
|
||||
third = c.colors.find {|x| x.name == 'third_one'}
|
||||
|
|
|
@ -48,7 +48,7 @@ describe IncomingLinksReport do
|
|||
|
||||
it 'with no IncomingLink records, it returns correct data' do
|
||||
stub_empty_referrers_data
|
||||
top_referrers[:data].should have(0).records
|
||||
top_referrers[:data].size.should == 0
|
||||
end
|
||||
|
||||
it 'with some IncomingLink records, it returns correct data' do
|
||||
|
@ -80,7 +80,7 @@ describe IncomingLinksReport do
|
|||
|
||||
it 'with no IncomingLink records, it returns correct data' do
|
||||
stub_empty_traffic_source_data
|
||||
top_traffic_sources[:data].should have(0).records
|
||||
top_traffic_sources[:data].size.should == 0
|
||||
end
|
||||
|
||||
it 'with some IncomingLink records, it returns correct data' do
|
||||
|
@ -108,7 +108,7 @@ describe IncomingLinksReport do
|
|||
|
||||
it 'with no IncomingLink records, it returns correct data' do
|
||||
stub_empty_referred_topics_data
|
||||
top_referred_topics[:data].should have(0).records
|
||||
top_referred_topics[:data].size.should == 0
|
||||
end
|
||||
|
||||
it 'with some IncomingLink records, it returns correct data' do
|
||||
|
|
|
@ -366,7 +366,7 @@ describe Invite do
|
|||
|
||||
invites = Invite.find_redeemed_invites_from(inviter)
|
||||
|
||||
expect(invites).to have(1).items
|
||||
invites.size.should == 1
|
||||
expect(invites.first).to eq redeemed_invite
|
||||
end
|
||||
end
|
||||
|
|
|
@ -40,7 +40,7 @@ describe Notification do
|
|||
lambda {
|
||||
reply = Fabricate(:basic_reply, user: post.user, topic: post.topic)
|
||||
process_alerts(reply)
|
||||
}.should_not change(post.user.notifications, :count).by(1)
|
||||
}.should_not change(post.user.notifications, :count)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ describe PostAlerter do
|
|||
topic = create_post_with_alerts.topic
|
||||
lambda {
|
||||
Fabricate(:post, topic: topic, user: topic.user, raw: '[quote="Bruce Wayne, post:1"]whatup[/quote]')
|
||||
}.should_not change(topic.user.notifications, :count).by(1)
|
||||
}.should_not change(topic.user.notifications, :count)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -76,7 +76,7 @@ describe PostAlerter do
|
|||
mention_post
|
||||
lambda {
|
||||
create_post_with_alerts(user: user, raw: 'second post', topic: topic)
|
||||
}.should_not change(user.notifications, :count).by(1)
|
||||
}.should_not change(user.notifications, :count)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue