spec/integration/virtus/value_object_spec.rb in virtus-1.0.2 vs spec/integration/virtus/value_object_spec.rb in virtus-1.0.3
- old
+ new
@@ -24,25 +24,25 @@
subject { class_under_test.new(attribute_values) }
describe 'initialization' do
it 'sets the attribute values provided to Class.new' do
- class_under_test.new(:latitude => 10000.001).latitude.should == 10000.001
- subject.latitude.should eql(attribute_values[:latitude])
+ expect(class_under_test.new(:latitude => 10000.001).latitude).to eq(10000.001)
+ expect(subject.latitude).to eql(attribute_values[:latitude])
end
end
describe 'writer visibility' do
it 'attributes are configured for private writers' do
- class_under_test.attribute_set[:latitude].public_reader?.should be(true)
- class_under_test.attribute_set[:longitude].public_writer?.should be(false)
+ expect(class_under_test.attribute_set[:latitude].public_reader?).to be(true)
+ expect(class_under_test.attribute_set[:longitude].public_writer?).to be(false)
end
it 'writer methods are set to private' do
private_methods = class_under_test.private_instance_methods
private_methods.map! { |m| m.to_s }
- private_methods.should include('latitude=', 'longitude=', 'attributes=')
+ expect(private_methods).to include('latitude=', 'longitude=', 'attributes=')
end
it 'attempts to call attribute writer methods raises NameError' do
expect { subject.latitude = 5.0 }.to raise_exception(NameError)
expect { subject.longitude = 5.0 }.to raise_exception(NameError)
@@ -50,50 +50,50 @@
end
describe 'equality' do
describe '#==' do
it 'returns true for different objects with the same state' do
- subject.should == instance_with_equal_state
+ expect(subject).to eq(instance_with_equal_state)
end
it 'returns false for different objects with different state' do
- subject.should_not == instance_with_different_state
+ expect(subject).not_to eq(instance_with_different_state)
end
end
describe '#eql?' do
it 'returns true for different objects with the same state' do
- subject.should eql(instance_with_equal_state)
+ expect(subject).to eql(instance_with_equal_state)
end
it 'returns false for different objects with different state' do
- subject.should_not eql(instance_with_different_state)
+ expect(subject).not_to eql(instance_with_different_state)
end
end
describe '#equal?' do
it 'returns false for different objects with the same state' do
- subject.should_not equal(instance_with_equal_state)
+ expect(subject).not_to equal(instance_with_equal_state)
end
it 'returns false for different objects with different state' do
- subject.should_not equal(instance_with_different_state)
+ expect(subject).not_to equal(instance_with_different_state)
end
end
describe '#hash' do
it 'returns the same value for different objects with the same state' do
- subject.hash.should eql(instance_with_equal_state.hash)
+ expect(subject.hash).to eql(instance_with_equal_state.hash)
end
it 'returns different values for different objects with different state' do
- subject.hash.should_not eql(instance_with_different_state.hash)
+ expect(subject.hash).not_to eql(instance_with_different_state.hash)
end
end
end
describe '#inspect' do
it 'includes the class name and attribute values' do
- subject.inspect.should == '#<GeoLocation latitude=10.0 longitude=20.0>'
+ expect(subject.inspect).to eq('#<GeoLocation latitude=10.0 longitude=20.0>')
end
end
end