spec/equatable/subclass_spec.rb in equatable-0.4.0 vs spec/equatable/subclass_spec.rb in equatable-0.5.0
- old
+ new
@@ -1,6 +1,6 @@
-# -*- encoding: utf-8 -*-
+# encoding: utf-8
require 'spec_helper'
describe Equatable, 'subclass' do
let(:name) { 'Value' }
@@ -18,49 +18,46 @@
end
end
}
let(:subclass) { ::Class.new(klass) }
- before {
- klass.stub(:name).and_return name
- }
-
subject { subclass.new(value) }
- it { subclass.superclass.should == klass }
+ before { allow(klass).to receive(:name).and_return(name) }
- it { should respond_to :value }
+ it { expect(subclass.superclass).to eq(klass) }
+ it { is_expected.to respond_to(:value) }
+
describe '#inspect' do
- it { subject.inspect.should eql('#<Value value=11>') }
+ it { expect(subject.inspect).to eql('#<Value value=11>') }
end
describe '#eql?' do
context 'when objects are similar' do
let(:other) { subject.dup }
- it { subject.eql?(other).should be_true }
+ it { expect(subject.eql?(other)).to eql(true) }
end
context 'when objects are different' do
- let(:other) { stub('other') }
+ let(:other) { double('other') }
- it { subject.eql?(other).should be_false }
+ it { expect(subject.eql?(other)).to eql(false) }
end
end
describe '#==' do
context 'when objects are similar' do
let(:other) { subject.dup }
- it { (subject == other).should be_true }
+ it { expect(subject == other).to eql(true) }
end
context 'when objects are different' do
- let(:other) { stub('other') }
+ let(:other) { double('other') }
- it { (subject == other)}
+ it { expect(subject == other).to eql(false) }
end
end
end
-
end