Replace should with expectations in specs

master
Guillaume Dott 2015-05-27 11:27:00 +02:00
parent c4bde860e2
commit 9533bf2c66
2 changed files with 22 additions and 21 deletions

View File

@ -9,9 +9,10 @@ describe ProjectHoneypot::Base do
it "returns a Url object" do
url = base.lookup("127.10.10.5")
url.should be_a ProjectHoneypot::Url
url.last_activity.should == 1
url.score.should == 63
expect(url).to be_a(ProjectHoneypot::Url)
expect(url.last_activity).to eq(1)
expect(url.score).to eq(63)
end
it "looks up non-ip addresses" do

View File

@ -5,37 +5,37 @@ describe ProjectHoneypot::Url do
let(:url) { ProjectHoneypot::Url.new("127.0.0.1", "127.1.63.3") }
it "is safe" do
url.should_not be_safe
expect(url.safe?).to be false
url.safe?(score: 63).should be_false
url.safe?(score: 64).should be_true
expect(url.safe?(score: 63)).to be false
expect(url.safe?(score: 64)).to be true
url.safe?(last_activity: 1).should be_false
url.safe?(last_activity: 2).should be_true
expect(url.safe?(last_activity: 1)).to be false
expect(url.safe?(last_activity: 2)).to be true
url.safe?(last_activity: 2, score: 64).should be_true
url.safe?(last_activity: 1, score: 64).should be_false
url.safe?(last_activity: 2, score: 63).should be_false
expect(url.safe?(last_activity: 2, score: 64)).to be true
expect(url.safe?(last_activity: 1, score: 64)).to be false
expect(url.safe?(last_activity: 2, score: 63)).to be false
url.safe?(offenses: [:comment_spammer]).should be_true
url.safe?(offenses: [:suspicious, :comment_spammer]).should be_false
expect(url.safe?(offenses: [:comment_spammer])).to be true
expect(url.safe?(offenses: [:suspicious, :comment_spammer])).to be false
end
it "has the correct latest activity" do
url.last_activity.should == 1
expect(url.last_activity).to eq(1)
end
it "has the correct score" do
url.score.should == 63
expect(url.score).to eq(63)
end
it "has the correct offenses" do
url.offenses.should include(:suspicious)
url.offenses.should include(:harvester)
url.offenses.should_not include(:comment_spammer)
url.should be_suspicious
url.should be_harvester
url.should_not be_comment_spammer
expect(url.offenses).to include(:suspicious)
expect(url.offenses).to include(:harvester)
expect(url.offenses).to_not include(:comment_spammer)
expect(url).to be_suspicious
expect(url).to be_harvester
expect(url).to_not be_comment_spammer
end
end