active_interaction 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -51,5 +51,5 @@ I18n.load_path.unshift(*Dir[File.expand_path(
51
51
  #
52
52
  # @since 1.0.0
53
53
  #
54
- # @version 1.5.0
54
+ # @version 1.5.1
55
55
  module ActiveInteraction end
@@ -1,8 +1,7 @@
1
1
  # coding: utf-8
2
2
 
3
- # rubocop:disable Documentation
4
3
  module ActiveInteraction
5
- class GroupedInput
4
+ class GroupedInput # rubocop:disable Style/Documentation
6
5
  # Required for Ruby <= 1.9.3.
7
6
  def [](name)
8
7
  send(name)
@@ -14,7 +13,7 @@ module ActiveInteraction
14
13
  end unless method_defined?(:[]=)
15
14
  end
16
15
 
17
- class Errors
16
+ class Errors # rubocop:disable Style/Documentation
18
17
  # Required for Rails < 3.2.13.
19
18
  protected :initialize_dup
20
19
  end
@@ -240,7 +240,7 @@ module ActiveInteraction
240
240
  self.class.filters.each do |name, filter|
241
241
  begin
242
242
  public_send("#{name}=", filter.clean(inputs[name]))
243
- rescue InvalidValueError, MissingValueError, InvalidNestedValueError
243
+ rescue Error
244
244
  # #type_check will add errors if appropriate.
245
245
  end
246
246
  end
@@ -50,9 +50,8 @@ module ActiveInteraction
50
50
  # @return [Boolean]
51
51
  #
52
52
  # @since 1.5.0
53
- def has_attribute?(name) # rubocop:disable PredicateName
53
+ def has_attribute?(name) # rubocop:disable Style/PredicateName
54
54
  self.class.filters.key?(name.to_sym)
55
55
  end
56
- # rubocop:enable PredicateName
57
56
  end
58
57
  end
@@ -3,10 +3,10 @@
3
3
  begin
4
4
  require 'active_record'
5
5
  rescue LoadError
6
- module ActiveRecord # rubocop:disable Documentation
6
+ module ActiveRecord # rubocop:disable Style/Documentation
7
7
  Rollback = Class.new(ActiveInteraction::Error)
8
8
 
9
- class Base # rubocop:disable Documentation
9
+ class Base # rubocop:disable Style/Documentation
10
10
  def self.transaction(*)
11
11
  yield
12
12
  rescue Rollback
@@ -38,7 +38,7 @@ module ActiveInteraction
38
38
  end
39
39
  end
40
40
 
41
- module ClassMethods # rubocop:disable Documentation
41
+ module ClassMethods # rubocop:disable Style/Documentation
42
42
  # @param klass [Class]
43
43
  def inherited(klass)
44
44
  klass.transaction(transaction?, transaction_options.dup)
@@ -67,7 +67,7 @@ module ActiveInteraction
67
67
  # @param filter_name [Symbol]
68
68
  # @param input_value [Object]
69
69
  def initialize(filter_name, input_value)
70
- super()
70
+ super("#{filter_name}: #{input_value.inspect}")
71
71
 
72
72
  @filter_name = filter_name
73
73
  @input_value = input_value
@@ -48,7 +48,7 @@ module ActiveInteraction
48
48
  super do |klass, names, options|
49
49
  filter = klass.new(name.to_s.singularize.to_sym, options, &block)
50
50
 
51
- validate(filter, names)
51
+ validate!(filter, names)
52
52
 
53
53
  filters[filter.name] = filter
54
54
  end
@@ -71,7 +71,7 @@ module ActiveInteraction
71
71
  # @param names [Array<Symbol>]
72
72
  #
73
73
  # @raise [InvalidFilterError]
74
- def validate(filter, names)
74
+ def validate!(filter, names)
75
75
  unless filters.empty?
76
76
  fail InvalidFilterError, 'multiple filters in array block'
77
77
  end
@@ -80,11 +80,11 @@ module ActiveInteraction
80
80
  fail InvalidFilterError, 'attribute names in array block'
81
81
  end
82
82
 
83
- # rubocop:disable GuardClause
84
83
  if filter.default?
85
84
  fail InvalidDefaultError, 'default values in array block'
86
85
  end
87
- # rubocop:enable GuardClause
86
+
87
+ nil
88
88
  end
89
89
  end
90
90
  end
@@ -49,7 +49,7 @@ module ActiveInteraction
49
49
  #
50
50
  # @return [Boolean]
51
51
  def matches?(value)
52
- @klass === value || # rubocop:disable CaseEquality
52
+ @klass === value || # rubocop:disable Style/CaseEquality
53
53
  value.is_a?(@klass)
54
54
  end
55
55
  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.5.0')
8
+ VERSION = Gem::Version.new('1.5.1')
9
9
  end
@@ -2,14 +2,14 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- InteractionWithFilter = Class.new(TestInteraction) do
5
+ InteractionWithFloatFilter = Class.new(TestInteraction) do
6
6
  float :thing
7
7
  end
8
8
 
9
9
  describe ActiveInteraction::ActiveRecordable do
10
10
  include_context 'interactions'
11
11
 
12
- let(:described_class) { InteractionWithFilter }
12
+ let(:described_class) { InteractionWithFloatFilter }
13
13
 
14
14
  describe '#column_for_attribute(name)' do
15
15
  let(:column) { outcome.column_for_attribute(name) }
@@ -145,8 +145,7 @@ describe ActiveInteraction::Errors do
145
145
  }
146
146
  }
147
147
  }
148
- }
149
- )
148
+ })
150
149
 
151
150
  other.add_sym(:attribute, :invalid_type, type: nil)
152
151
  end
@@ -85,8 +85,7 @@ describe I18nInteraction do
85
85
  }
86
86
  },
87
87
  types: TYPES.each_with_object({}) { |e, a| a[e] = e.reverse }
88
- }
89
- )
88
+ })
90
89
 
91
90
  @locale = I18n.locale
92
91
  I18n.locale = 'hsilgne'
@@ -4,9 +4,18 @@ require 'spec_helper'
4
4
  require 'json'
5
5
  require 'yaml'
6
6
 
7
- describe 'InterfaceInteraction' do
7
+ InterfaceInteraction = Class.new(TestInteraction) do
8
+ interface :anything
9
+ end
10
+
11
+ describe InterfaceInteraction do
12
+ include_context 'interactions'
8
13
  it_behaves_like 'an interaction',
9
14
  :interface,
10
15
  -> { [JSON, YAML].sample },
11
16
  methods: [:dump, :load]
17
+
18
+ it 'succeeds when given nil' do
19
+ expect { result }.to_not raise_error
20
+ end
12
21
  end
@@ -2,6 +2,15 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe 'ModelInteraction' do
5
+ ModelInteraction = Class.new(TestInteraction) do
6
+ model :object
7
+ end
8
+
9
+ describe ModelInteraction do
10
+ include_context 'interactions'
6
11
  it_behaves_like 'an interaction', :model, -> { // }, class: Regexp
12
+
13
+ it 'succeeds when given nil' do
14
+ expect { result }.to_not raise_error
15
+ end
7
16
  end
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.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Lasseigne
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-02-05 00:00:00.000000000 Z
12
+ date: 2015-04-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel
@@ -37,112 +37,112 @@ dependencies:
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.6'
40
+ version: '1.9'
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
- version: '1.6'
47
+ version: '1.9'
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
- version: '0.7'
54
+ version: '0.8'
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
- version: '0.7'
61
+ version: '0.8'
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
- version: '4.2'
68
+ version: '4.5'
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
- version: '4.2'
75
+ version: '4.5'
76
76
  - !ruby/object:Gem::Dependency
77
77
  name: guard-rubocop
78
78
  requirement: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.1'
82
+ version: '1.2'
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
- version: '1.1'
89
+ version: '1.2'
90
90
  - !ruby/object:Gem::Dependency
91
91
  name: kramdown
92
92
  requirement: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '1.5'
96
+ version: '1.7'
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
- version: '1.5'
103
+ version: '1.7'
104
104
  - !ruby/object:Gem::Dependency
105
105
  name: rake
106
106
  requirement: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '10.3'
110
+ version: '10.4'
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
- version: '10.3'
117
+ version: '10.4'
118
118
  - !ruby/object:Gem::Dependency
119
119
  name: rspec
120
120
  requirement: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '3.1'
124
+ version: '3.2'
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
- version: '3.1'
131
+ version: '3.2'
132
132
  - !ruby/object:Gem::Dependency
133
133
  name: rubocop
134
134
  requirement: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '0.28'
138
+ version: '0.30'
139
139
  type: :development
140
140
  prerelease: false
141
141
  version_requirements: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '0.28'
145
+ version: '0.30'
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: yard
148
148
  requirement: !ruby/object:Gem::Requirement
@@ -157,7 +157,9 @@ dependencies:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0.8'
160
- description: Manage application specific business logic.
160
+ description: |2
161
+ ActiveInteraction manages application-specific business logic. It is an
162
+ implementation of the command pattern in Ruby.
161
163
  email:
162
164
  - aaron.lasseigne@gmail.com
163
165
  - taylor@fausak.me
@@ -166,6 +168,7 @@ extensions: []
166
168
  extra_rdoc_files: []
167
169
  files:
168
170
  - CHANGELOG.md
171
+ - CONTRIBUTING.md
169
172
  - LICENSE.txt
170
173
  - README.md
171
174
  - lib/active_interaction.rb
@@ -250,7 +253,7 @@ files:
250
253
  - spec/support/concerns.rb
251
254
  - spec/support/filters.rb
252
255
  - spec/support/interactions.rb
253
- homepage: http://orgsync.github.io/active_interaction/
256
+ homepage: http://devblog.orgsync.com/active_interaction/
254
257
  licenses:
255
258
  - MIT
256
259
  metadata: {}
@@ -270,7 +273,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
270
273
  version: '0'
271
274
  requirements: []
272
275
  rubyforge_project:
273
- rubygems_version: 2.4.5
276
+ rubygems_version: 2.4.6
274
277
  signing_key:
275
278
  specification_version: 4
276
279
  summary: Manage application specific business logic.