Skip to content

Commit

Permalink
Add spec for Yardstick::Rule#hash
Browse files Browse the repository at this point in the history
* Refactor existing Yardstick::Rule specs to match modern style
  • Loading branch information
dkubb committed Nov 12, 2012
1 parent b5e9a32 commit adcc8b0
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions spec/semipublic/yardstick/rule_spec.rb
@@ -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

0 comments on commit adcc8b0

Please sign in to comment.