interactor 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 61cda0fd8ba19d73ab1928d83b89f1e033ea7ece
4
- data.tar.gz: df675488f9066ff98f40e7ef7f30becca42f57b1
3
+ metadata.gz: 3738599fd10bf883b7ccdc29ff2fbe4322a75851
4
+ data.tar.gz: 71e339e19b1dbcb3c4a874060ae4f38e1cd37702
5
5
  SHA512:
6
- metadata.gz: c5c02256cb1688170d08dcef72e7d6f390dda20a4263e1daf5f7e8596f54968ad39b0a352dd2659888c45e4360db62142cc0240100db7a8a82a96b43f3063012
7
- data.tar.gz: d58aa049b0de1c0bf204fc8bcc4a7475a4e9158d90e3bd8ba9072a5ae15e34137e98d68ce772e945d32537d7cb525c29db1ed969cfd3f4fc4c515796cac962d3
6
+ metadata.gz: c8c053d53c21e3ee48e905959e8ff8298b3caa93c7df9ad2c60793b3108cf0b1b3dd106563bd5630898bb54944b7bc6eb9b1b63dc88ee736eebdfe060265581d
7
+ data.tar.gz: b0c7b00554345b259ffbcaae25c1817f99e7796300a1c11e8f1f1939eb9e9cd20693b57667c247b74a7105fa5fadb9490adcace3d7527b8b869f61d94b222c04
data/README.md CHANGED
@@ -121,7 +121,7 @@ class PlaceOrder
121
121
  end
122
122
  ```
123
123
 
124
- Breaking your interactors into bite-sized pieces also gives you the benefit or reusability. In our example above, there may be several scenarios where you may want to check inventory. Encapsulating that logic in one interactor enables you to reuse that interactor, reducing duplication.
124
+ Breaking your interactors into bite-sized pieces also gives you the benefit of reusability. In our example above, there may be several scenarios where you may want to check inventory. Encapsulating that logic in one interactor enables you to reuse that interactor, reducing duplication.
125
125
 
126
126
  ## Examples
127
127
 
data/interactor.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "interactor"
5
- spec.version = "2.0.0"
5
+ spec.version = "2.0.1"
6
6
 
7
7
  spec.author = "Collective Idea"
8
8
  spec.email = "info@collectiveidea.com"
data/lib/interactor.rb CHANGED
@@ -47,6 +47,6 @@ module Interactor
47
47
  end
48
48
 
49
49
  def respond_to_missing?(method, *)
50
- context.key?(method) || super
50
+ (context && context.key?(method)) || super
51
51
  end
52
52
  end
data/spec/support/lint.rb CHANGED
@@ -127,18 +127,28 @@ shared_examples :lint do
127
127
  end
128
128
 
129
129
  describe "context deferral" do
130
- let(:instance) { interactor.new(foo: "bar") }
130
+ context "initialized" do
131
+ let(:instance) { interactor.new(foo: "bar") }
131
132
 
132
- it "defers to keys that exist in the context" do
133
- expect(instance).to respond_to(:foo)
134
- expect(instance.foo).to eq("bar")
135
- expect { instance.method(:foo) }.not_to raise_error
133
+ it "defers to keys that exist in the context" do
134
+ expect(instance).to respond_to(:foo)
135
+ expect(instance.foo).to eq("bar")
136
+ expect { instance.method(:foo) }.not_to raise_error
137
+ end
138
+
139
+ it "bombs if the key does not exist in the context" do
140
+ expect(instance).not_to respond_to(:baz)
141
+ expect { instance.baz }.to raise_error(NoMethodError)
142
+ expect { instance.method(:baz) }.to raise_error(NameError)
143
+ end
136
144
  end
137
145
 
138
- it "bombs if the key does not exist in the context" do
139
- expect(instance).not_to respond_to(:baz)
140
- expect { instance.baz }.to raise_error(NoMethodError)
141
- expect { instance.method(:baz) }.to raise_error(NameError)
146
+ context "allocated" do
147
+ let(:instance) { interactor.allocate }
148
+
149
+ it "doesn't respond to context keys before the context is set" do
150
+ expect(instance).not_to respond_to(:foo)
151
+ end
142
152
  end
143
153
  end
144
154
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: interactor
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Collective Idea
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-19 00:00:00.000000000 Z
11
+ date: 2013-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler