active_interaction 1.0.1 → 1.0.2

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: 152f0300bf27243acb0d7f0068b44a8b7c66fa8c
4
- data.tar.gz: d2741f24682a5ede49215e0ddb7191625f27e189
3
+ metadata.gz: 07e6b7eb1027d9cb220bccdd4ad1e97d23d85dc2
4
+ data.tar.gz: 07dfb947aafeea6442164d08ed03b37c2738f446
5
5
  SHA512:
6
- metadata.gz: b2976e0ff9e7b3ad09181672922fad54b821b46f8e4380afa1eb6579121f4b7cc6fc854cd59bdbf983c5ab0047dc56744ebb010585016511cd8ea193a13b733c
7
- data.tar.gz: a2f08efa2b55ebb4ebbc86f1ea51cce4d5adc465fe6d5cc8d2c6667a4aebeac40e87041d8690fd94b36a6f753b541ee58e70662c1836a56269fe71c932413a8d
6
+ metadata.gz: 1fac720546402daaed4ca81cb48266d394acef2133da63029d9288e5bc5055467766a290ea952a3716bb298f17e112bbd819d434593c173bfe2708f3b7fabb21
7
+ data.tar.gz: 2b1263e75189e213d1c1ac289b51eb374b8bb3cde3846ee1944954a1b0ff41d889f99e77d604de3eb8dbfe54229b76d39486b38622f28880247df486c0288e6c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # [Master][]
2
2
 
3
+ # [1.0.2][] (2014-02-07)
4
+
5
+ - Stop creating duplicate errors on subsequent calls to `valid?`.
6
+
3
7
  # [1.0.1][] (2014-02-04)
4
8
 
5
9
  - Short circuit `valid?` after successfully running an interaction.
@@ -125,8 +129,9 @@
125
129
 
126
130
  - Initial release.
127
131
 
128
- [master]: https://github.com/orgsync/active_interaction/compare/v1.0.1...master
129
- [1.0.0]: https://github.com/orgsync/active_interaction/compare/v1.0.0...v1.0.1
132
+ [master]: https://github.com/orgsync/active_interaction/compare/v1.0.2...master
133
+ [1.0.2]: https://github.com/orgsync/active_interaction/compare/v1.0.1...v1.0.2
134
+ [1.0.1]: https://github.com/orgsync/active_interaction/compare/v1.0.0...v1.0.1
130
135
  [1.0.0]: https://github.com/orgsync/active_interaction/compare/v0.10.2...v1.0.0
131
136
  [0.10.2]: https://github.com/orgsync/active_interaction/compare/v0.10.1...v0.10.2
132
137
  [0.10.1]: https://github.com/orgsync/active_interaction/compare/v0.10.0...v0.10.1
@@ -42,5 +42,5 @@ I18n.backend.load_translations(
42
42
  #
43
43
  # @since 1.0.0
44
44
  #
45
- # @version 1.0.1
45
+ # @version 1.0.2
46
46
  module ActiveInteraction end
@@ -27,10 +27,6 @@ module ActiveInteraction
27
27
  extend ActiveSupport::Concern
28
28
  include ActiveModel::Validations
29
29
 
30
- included do
31
- validate :runtime_errors
32
- end
33
-
34
30
  # @return [Errors]
35
31
  def errors
36
32
  @_interaction_errors
@@ -55,22 +51,20 @@ module ActiveInteraction
55
51
  def result=(result)
56
52
  if errors.empty?
57
53
  @_interaction_result = result
58
- @_interaction_runtime_errors = nil
59
54
  @_interaction_valid = true
60
55
  else
61
56
  @_interaction_result = nil
62
- @_interaction_runtime_errors = errors.dup
63
57
  @_interaction_valid = false
64
58
  end
65
59
  end
66
60
 
67
61
  # @return [Boolean]
68
62
  def valid?(*)
69
- unless instance_variable_defined?(:@_interaction_valid)
70
- @_interaction_valid = false
63
+ if instance_variable_defined?(:@_interaction_valid)
64
+ return @_interaction_valid
71
65
  end
72
66
 
73
- @_interaction_valid || super || (self.result = nil)
67
+ super
74
68
  end
75
69
 
76
70
  private
@@ -120,22 +114,13 @@ module ActiveInteraction
120
114
  end
121
115
  end
122
116
 
123
- # @!group Validations
124
-
125
- def runtime_errors
126
- if @_interaction_runtime_errors
127
- errors.merge!(@_interaction_runtime_errors)
128
- end
129
- end
130
-
131
117
  #
132
118
  module ClassMethods
133
119
  def new(*)
134
120
  super.tap do |instance|
135
121
  {
136
122
  :@_interaction_errors => Errors.new(instance),
137
- :@_interaction_result => nil,
138
- :@_interaction_runtime_errors => nil
123
+ :@_interaction_result => nil
139
124
  }.each do |symbol, obj|
140
125
  instance.instance_variable_set(symbol, obj)
141
126
  end
@@ -5,5 +5,5 @@ module ActiveInteraction
5
5
  # The version number.
6
6
  #
7
7
  # @return [Gem::Version]
8
- VERSION = Gem::Version.new('1.0.1')
8
+ VERSION = Gem::Version.new('1.0.2')
9
9
  end
@@ -192,24 +192,6 @@ describe ActiveInteraction::Base do
192
192
  expect(outcome).to be_a described_class
193
193
  end
194
194
 
195
- context 'setting the result' do
196
- let(:described_class) do
197
- Class.new(TestInteraction) do
198
- boolean :attribute
199
-
200
- validate do
201
- @_interaction_result = SecureRandom.hex
202
- errors.add(:attribute, SecureRandom.hex)
203
- end
204
- end
205
- end
206
-
207
- it 'sets the result to nil' do
208
- expect(outcome).to be_invalid
209
- expect(result).to be_nil
210
- end
211
- end
212
-
213
195
  context 'failing validations' do
214
196
  it 'returns an invalid outcome' do
215
197
  expect(outcome).to_not be_valid
@@ -123,6 +123,11 @@ describe ActiveInteraction::Runnable do
123
123
  it 'returns false' do
124
124
  expect(instance).to_not be_valid
125
125
  end
126
+
127
+ it 'does not duplicate errors on subsequent calls' do
128
+ instance.valid?
129
+ expect { instance.valid? }.to_not change { instance.errors.count }.by 1
130
+ end
126
131
  end
127
132
  end
128
133
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_interaction
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Lasseigne
@@ -9,124 +9,124 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-04 00:00:00.000000000 Z
12
+ date: 2014-02-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ">="
18
+ - - '>='
19
19
  - !ruby/object:Gem::Version
20
20
  version: '3'
21
- - - "<"
21
+ - - <
22
22
  - !ruby/object:Gem::Version
23
23
  version: '5'
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
- - - ">="
28
+ - - '>='
29
29
  - !ruby/object:Gem::Version
30
30
  version: '3'
31
- - - "<"
31
+ - - <
32
32
  - !ruby/object:Gem::Version
33
33
  version: '5'
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: bundler
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.5'
41
41
  type: :development
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.5'
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: coveralls
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.7'
55
55
  type: :development
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0.7'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: guard-rspec
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: '4.2'
69
69
  type: :development
70
70
  prerelease: false
71
71
  version_requirements: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ~>
74
74
  - !ruby/object:Gem::Version
75
75
  version: '4.2'
76
76
  - !ruby/object:Gem::Dependency
77
77
  name: rake
78
78
  requirement: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ~>
81
81
  - !ruby/object:Gem::Version
82
82
  version: '10.1'
83
83
  type: :development
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ~>
88
88
  - !ruby/object:Gem::Version
89
89
  version: '10.1'
90
90
  - !ruby/object:Gem::Dependency
91
91
  name: rdoc
92
92
  requirement: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ~>
95
95
  - !ruby/object:Gem::Version
96
96
  version: '4.1'
97
97
  type: :development
98
98
  prerelease: false
99
99
  version_requirements: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ~>
102
102
  - !ruby/object:Gem::Version
103
103
  version: '4.1'
104
104
  - !ruby/object:Gem::Dependency
105
105
  name: guard-rubocop
106
106
  requirement: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ~>
109
109
  - !ruby/object:Gem::Version
110
110
  version: '1.0'
111
111
  type: :development
112
112
  prerelease: false
113
113
  version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ~>
116
116
  - !ruby/object:Gem::Version
117
117
  version: '1.0'
118
118
  - !ruby/object:Gem::Dependency
119
119
  name: yard
120
120
  requirement: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ~>
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0.8'
125
125
  type: :development
126
126
  prerelease: false
127
127
  version_requirements: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - ~>
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0.8'
132
132
  description: Manage application specific business logic.
@@ -137,6 +137,10 @@ executables: []
137
137
  extensions: []
138
138
  extra_rdoc_files: []
139
139
  files:
140
+ - CHANGELOG.md
141
+ - LICENSE.txt
142
+ - README.md
143
+ - lib/active_interaction.rb
140
144
  - lib/active_interaction/base.rb
141
145
  - lib/active_interaction/concerns/active_modelable.rb
142
146
  - lib/active_interaction/concerns/hashable.rb
@@ -161,7 +165,6 @@ files:
161
165
  - lib/active_interaction/filters/time_filter.rb
162
166
  - lib/active_interaction/modules/validation.rb
163
167
  - lib/active_interaction/version.rb
164
- - lib/active_interaction.rb
165
168
  - spec/active_interaction/base_spec.rb
166
169
  - spec/active_interaction/concerns/active_modelable_spec.rb
167
170
  - spec/active_interaction/concerns/hashable_spec.rb
@@ -202,9 +205,6 @@ files:
202
205
  - spec/support/concerns.rb
203
206
  - spec/support/filters.rb
204
207
  - spec/support/interactions.rb
205
- - CHANGELOG.md
206
- - LICENSE.txt
207
- - README.md
208
208
  homepage: http://orgsync.github.io/active_interaction/
209
209
  licenses:
210
210
  - MIT
@@ -215,17 +215,17 @@ require_paths:
215
215
  - lib
216
216
  required_ruby_version: !ruby/object:Gem::Requirement
217
217
  requirements:
218
- - - ">="
218
+ - - '>='
219
219
  - !ruby/object:Gem::Version
220
220
  version: 1.9.3
221
221
  required_rubygems_version: !ruby/object:Gem::Requirement
222
222
  requirements:
223
- - - ">="
223
+ - - '>='
224
224
  - !ruby/object:Gem::Version
225
225
  version: '0'
226
226
  requirements: []
227
227
  rubyforge_project:
228
- rubygems_version: 2.1.11
228
+ rubygems_version: 2.2.0
229
229
  signing_key:
230
230
  specification_version: 4
231
231
  summary: Manage application specific business logic.