Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Refactor existing Yardstick::Rule specs to match modern style
- Loading branch information
Showing
1 changed file
with
19 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,34 @@ | ||
require 'spec_helper' | ||
|
||
describe Yardstick::Rule do | ||
let(:object) { described_class.new(description) { true } } | ||
let(:description) { 'test rule' } | ||
|
||
describe '#eql?' do | ||
subject { object.eql?(other) } | ||
|
||
describe 'when rules are equal' do | ||
before do | ||
@rule = Yardstick::Rule.new('test rule') { true } | ||
@other = Yardstick::Rule.new('test rule') { true } | ||
end | ||
let(:other) { described_class.new(description) { true } } | ||
|
||
it 'should return true' do | ||
@rule.eql?(@other).should be_true | ||
it 'is true' do | ||
should be(true) | ||
end | ||
end | ||
|
||
describe 'when rules are not equal' do | ||
before do | ||
@rule = Yardstick::Rule.new('test rule') { true } | ||
@other = Yardstick::Rule.new('other rule') { true } | ||
end | ||
let(:other) { described_class.new('other rule') { true } } | ||
|
||
it 'should return false' do | ||
@rule.eql?(@other).should be_false | ||
it 'is false' do | ||
should be(false) | ||
end | ||
end | ||
end | ||
|
||
describe '#hash' do | ||
subject { object.hash } | ||
|
||
it 'is the expected hash' do | ||
should == description.hash | ||
end | ||
end | ||
end |