equalizer 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  language: ruby
2
- bundler_args: --without yard guard
2
+ before_install: gem install bundler
3
+ bundler_args: --without yard guard metrics
3
4
  script: "bundle exec rake spec"
4
5
  rvm:
5
6
  - 1.8.7
data/Gemfile CHANGED
@@ -15,10 +15,6 @@ group :guard do
15
15
  gem 'guard-rspec', '~> 1.2.1'
16
16
  end
17
17
 
18
- group :benchmarks do
19
- gem 'rbench', '~> 0.2.3'
20
- end
21
-
22
18
  platform :jruby do
23
19
  group :jruby do
24
20
  gem 'jruby-openssl', '~> 0.7.4'
data/README.md CHANGED
@@ -37,7 +37,7 @@ Examples
37
37
  class GeoLocation
38
38
  include Equalizer.new(:latitude, :longitude)
39
39
 
40
- attr_reader :latitidue, :longitude
40
+ attr_reader :latitude, :longitude
41
41
 
42
42
  def initialize(latitude, longitude)
43
43
  @latitude, @longitude = latitude, longitude
@@ -1,3 +1,3 @@
1
1
  ---
2
2
  threshold: 6
3
- total_score: 29
3
+ total_score: 41
@@ -114,7 +114,7 @@ private
114
114
  # @api public
115
115
  def ==(other)
116
116
  other = coerce(other) if respond_to?(:coerce, true)
117
- !!(self.class <=> other.class) && cmp?(__method__, other)
117
+ other.kind_of?(self.class) && cmp?(__method__, other)
118
118
  end
119
119
 
120
120
  end # module Methods
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Equalizer < Module
4
- VERSION = '0.0.1'.freeze
4
+ VERSION = '0.0.2'.freeze
5
5
  end
@@ -5,9 +5,10 @@ require 'spec_helper'
5
5
  describe Equalizer::Methods, '#==' do
6
6
  subject { object == other }
7
7
 
8
- let(:object) { described_class.new(true) }
8
+ let(:object) { described_class.new(true) }
9
+ let(:described_class) { Class.new(super_class) }
9
10
 
10
- let(:described_class) do
11
+ let(:super_class) do
11
12
  Class.new do
12
13
  include Equalizer::Methods
13
14
 
@@ -43,13 +44,25 @@ describe Equalizer::Methods, '#==' do
43
44
  end
44
45
  end
45
46
 
46
- context 'with an equivalent object of a subclass' do
47
+ context 'with a subclass instance having equivalent obervable state' do
47
48
  let(:other) { Class.new(described_class).new(true) }
48
49
 
49
50
  it { should be(true) }
50
51
 
51
- it 'is symmetric' do
52
- should eql(other == object)
52
+ it 'is not symmetric' do
53
+ # the subclass instance should maintain substitutability with the object
54
+ # (in the LSP sense) the reverse is not true.
55
+ should_not eql(other == object)
56
+ end
57
+ end
58
+
59
+ context 'with a superclass instance having equivalent observable state' do
60
+ let(:other) { super_class.new(true) }
61
+
62
+ it { should be(false) }
63
+
64
+ it 'is not symmetric' do
65
+ should_not eql(other == object)
53
66
  end
54
67
  end
55
68
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: equalizer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dan Kubb
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-11-22 00:00:00 Z
19
+ date: 2012-12-25 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: backports