Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add spec for Yardstick::Rule#hash

* Refactor existing Yardstick::Rule specs to match modern style
  • Loading branch information...
commit adcc8b02f16f7051b009d63fae155790b1180998 1 parent b5e9a32
Dan Kubb authored
Showing with 19 additions and 12 deletions.
  1. +19 −12 spec/semipublic/yardstick/rule_spec.rb
31 spec/semipublic/yardstick/rule_spec.rb
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.