spec/support/shared/support/lookup.rb in arachni-1.2.1 vs spec/support/shared/support/lookup.rb in arachni-1.3
- old
+ new
@@ -1,97 +1,97 @@
require 'spec_helper'
shared_examples_for 'lookup' do
subject { described_class.new }
- it { should respond_to :collection }
+ it { is_expected.to respond_to :collection }
describe '#<<' do
it 'adds an object and return self' do
- (subject << 'test').should == subject
+ expect(subject << 'test').to eq(subject)
end
it 'aliased to #add' do
- subject.add( 'test2' ).should == subject
+ expect(subject.add( 'test2' )).to eq(subject)
end
end
describe '#include?' do
context 'when an object is included' do
it 'returns true' do
subject << 'test'
subject << 'test2'
- subject.include?( 'test' ).should be_true
- subject.include?( 'test2' ).should be_true
+ expect(subject.include?( 'test' )).to be_truthy
+ expect(subject.include?( 'test2' )).to be_truthy
end
end
context 'when an object is not included' do
it 'returns false' do
- subject.include?( 'test3' ).should be_false
+ expect(subject.include?( 'test3' )).to be_falsey
end
end
end
describe '#delete?' do
it 'deletes an object and return self' do
subject << 'test'
- subject.include?( 'test' ).should be_true
- subject.delete( 'test' ).should be_true
- subject.include?( 'test' ).should be_false
+ expect(subject.include?( 'test' )).to be_truthy
+ expect(subject.delete( 'test' )).to be_truthy
+ expect(subject.include?( 'test' )).to be_falsey
end
end
describe '#empty?' do
context 'when empty' do
it 'returns true' do
- subject.empty?.should be_true
+ expect(subject.empty?).to be_truthy
end
end
context 'when not empty' do
it 'returns false' do
subject << 'test'
- subject.empty?.should be_false
+ expect(subject.empty?).to be_falsey
end
end
end
describe '#any?' do
context 'when empty' do
it 'returns false' do
- subject.any?.should be_false
+ expect(subject.any?).to be_falsey
end
end
context 'when not empty' do
it 'returns true' do
subject << 'test'
- subject.any?.should be_true
+ expect(subject.any?).to be_truthy
end
end
end
describe '#size' do
it 'returns the size' do
bf = described_class.new
- bf.size.should == 0
+ expect(bf.size).to eq(0)
bf << '1'
- bf.size.should == 1
+ expect(bf.size).to eq(1)
bf << '1'
- bf.size.should == 1
+ expect(bf.size).to eq(1)
bf << '2'
- bf.size.should == 2
+ expect(bf.size).to eq(2)
end
end
describe '#clear' do
it 'empties the list' do
bf = described_class.new
bf << '1'
bf << '2'
- bf.size.should == 2
+ expect(bf.size).to eq(2)
bf.clear
- bf.size.should == 0
+ expect(bf.size).to eq(0)
end
end
describe '#==' do
context 'when 2 lists are equal' do
@@ -99,22 +99,22 @@
new = described_class.new
subject << 'test'
new << 'test'
- subject.should == new
+ expect(subject).to eq(new)
end
end
context 'when 2 lists are not equal' do
it 'returns false' do
new = described_class.new
subject << 'test'
new << 'test2'
- subject.should_not == new
+ expect(subject).not_to eq(new)
end
end
end
describe '#hash' do
@@ -123,34 +123,34 @@
new = described_class.new
subject << 'test'
new << 'test'
- subject.hash.should == new.hash
+ expect(subject.hash).to eq(new.hash)
end
end
context 'when 2 lists are not equal' do
it 'returns different values' do
new = described_class.new
subject << 'test'
new << 'test2'
- subject.hash.should_not == new.hash
+ expect(subject.hash).not_to eq(new.hash)
end
end
end
describe '#dup' do
it 'returns a copy' do
subject << 'test'
copy = subject.dup
- copy.should == subject
+ expect(copy).to eq(subject)
copy << 'test2'
- copy.should_not == subject
+ expect(copy).not_to eq(subject)
end
end
end