active_interaction 1.2.4 → 1.2.5

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: 8eae8e946fb9ec93d0abfa2e2264a7a35b9e8d56
4
- data.tar.gz: 7c976feedfef904516036479d67a789f147d8e4a
3
+ metadata.gz: 00f91c5498e12a8463f75e69ddc0b07f8b5b851e
4
+ data.tar.gz: 8336e72d5e12d0a793d3c7e188ab3eafb031df07
5
5
  SHA512:
6
- metadata.gz: 79162f4100cf2618ec44bddee98714af4d0b5b01d13cc8188f57a847031ece8c1657223d098912bdaa4b3ba89996cc233955d57cbd9ed44f5910cf44afb03164
7
- data.tar.gz: 30f668bd7172e2f5d45df36b38d4ecda7b00d0d5aa1ca1667c4b7fa13eb21c810d8260cd269763debc738614828a0314a941cbb6ad69b86950ac53e3ec3f008c
6
+ metadata.gz: 47efce81ccf4286b2906b5d79d438f6f69fc6ff76aecfb975544fb64599350d320c1728b9e43fde6ef59f976c95d577676d6b9cea8614eb8603b1b95e5f6c8ea
7
+ data.tar.gz: 2593157f8acc004d26a92b5c69fafb2034fd03abc6717034d34fcc0b34a69acf8f5e629716c905702d17421b815ab7152c8fa18ceb41491243afb1c4d4377d8c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # [Master][]
2
2
 
3
+ # [1.2.5][] (2014-08-15)
4
+
5
+ ## Fixed
6
+
7
+ - [#207][]: Fix a bug that incorrectly converted plural class names
8
+ to their singular form.
9
+ - [#206][]: Fix a bug that caused an i18n deprecation warning.
10
+ - [#201][]: Prevented time filters from being initialized with the
11
+ format option when time zones are available.
12
+
3
13
  # [1.2.4][] (2014-08-07)
4
14
 
5
15
  ## Fixed
@@ -328,7 +338,8 @@
328
338
 
329
339
  - Initial release.
330
340
 
331
- [master]: https://github.com/orgsync/active_interaction/compare/v1.2.4...master
341
+ [master]: https://github.com/orgsync/active_interaction/compare/v1.2.5...master
342
+ [1.2.5]: https://github.com/orgsync/active_interaction/compare/v1.2.4...v1.2.5
332
343
  [1.2.4]: https://github.com/orgsync/active_interaction/compare/v1.2.3...v1.2.4
333
344
  [1.2.3]: https://github.com/orgsync/active_interaction/compare/v1.2.2...v1.2.3
334
345
  [1.2.2]: https://github.com/orgsync/active_interaction/compare/v1.2.1...v1.2.2
@@ -429,4 +440,7 @@
429
440
  [#175]: https://github.com/orgsync/active_interaction/issues/175
430
441
  [#179]: https://github.com/orgsync/active_interaction/issues/179
431
442
  [#192]: https://github.com/orgsync/active_interaction/issues/192
443
+ [#201]: https://github.com/orgsync/active_interaction/issues/201
432
444
  [#203]: https://github.com/orgsync/active_interaction/issues/203
445
+ [#206]: https://github.com/orgsync/active_interaction/issues/206
446
+ [#207]: https://github.com/orgsync/active_interaction/issues/207
@@ -41,7 +41,6 @@ require 'active_interaction/backports'
41
41
 
42
42
  I18n.load_path += Dir[File.expand_path(
43
43
  File.join(%w[active_interaction locale *.yml]), File.dirname(__FILE__))]
44
- I18n.default_locale = :en
45
44
 
46
45
  # Manage application specific business logic.
47
46
  #
@@ -50,5 +49,5 @@ I18n.default_locale = :en
50
49
  #
51
50
  # @since 1.0.0
52
51
  #
53
- # @version 1.2.4
52
+ # @version 1.2.5
54
53
  module ActiveInteraction end
@@ -39,7 +39,7 @@ module ActiveInteraction
39
39
  #
40
40
  # @raise [InvalidClassError]
41
41
  def klass
42
- klass_name = options.fetch(:class, name).to_s.classify
42
+ klass_name = options.fetch(:class, name).to_s.camelize
43
43
  Object.const_get(klass_name)
44
44
  rescue NameError
45
45
  raise InvalidClassError, klass_name.inspect
@@ -26,6 +26,14 @@ module ActiveInteraction
26
26
  alias_method :_klass, :klass
27
27
  private :_klass
28
28
 
29
+ def initialize(name, options = {}, &block)
30
+ if options.key?(:format) && klass != Time
31
+ fail InvalidFilterError, 'format option unsupported with time zones'
32
+ end
33
+
34
+ super
35
+ end
36
+
29
37
  def cast(value)
30
38
  case value
31
39
  when Numeric
@@ -5,5 +5,5 @@ module ActiveInteraction
5
5
  # The version number.
6
6
  #
7
7
  # @return [Gem::Version]
8
- VERSION = Gem::Version.new('1.2.4')
8
+ VERSION = Gem::Version.new('1.2.5')
9
9
  end
@@ -162,13 +162,15 @@ describe ActiveInteraction::Base do
162
162
  expect(described_class.desc).to be_nil
163
163
  end
164
164
 
165
- it 'returns the description' do
166
- expect(described_class.desc(desc)).to eql desc
167
- end
165
+ context 'with a description' do
166
+ it 'returns the description' do
167
+ expect(described_class.desc(desc)).to eql desc
168
+ end
168
169
 
169
- it 'saves the description' do
170
- described_class.desc(desc)
171
- expect(described_class.desc).to eql desc
170
+ it 'saves the description' do
171
+ described_class.desc(desc)
172
+ expect(described_class.desc).to eql desc
173
+ end
172
174
  end
173
175
  end
174
176
 
@@ -3,6 +3,7 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  class Model; end
6
+ class Things; end
6
7
 
7
8
  describe ActiveInteraction::ModelFilter, :filter do
8
9
  include_context 'filters'
@@ -118,6 +119,16 @@ describe ActiveInteraction::ModelFilter, :filter do
118
119
  end
119
120
  end
120
121
 
122
+ context 'with a plural class' do
123
+ let(:value) { Things.new }
124
+
125
+ before { options[:class] = Things }
126
+
127
+ it 'returns the instance' do
128
+ expect(result).to eql value
129
+ end
130
+ end
131
+
121
132
  context 'with class as an invalid String' do
122
133
  before do
123
134
  options.merge!(class: 'invalid')
@@ -14,6 +14,26 @@ describe ActiveInteraction::TimeFilter, :filter do
14
14
  end
15
15
  end
16
16
 
17
+ describe '#initialize' do
18
+ context 'with a format' do
19
+ before { options[:format] = '%T' }
20
+
21
+ context 'with a time zone' do
22
+ before do
23
+ time_zone = double
24
+ allow(Time).to receive(:zone).and_return(time_zone)
25
+
26
+ time_with_zone = double
27
+ allow(time_zone).to receive(:at).and_return(time_with_zone)
28
+ end
29
+
30
+ it 'raises an error' do
31
+ expect { filter }.to raise_error(ActiveInteraction::InvalidFilterError)
32
+ end
33
+ end
34
+ end
35
+ end
36
+
17
37
  describe '#cast' do
18
38
  let(:result) { filter.cast(value) }
19
39
 
@@ -54,8 +54,11 @@ describe I18nInteraction do
54
54
  include_examples 'translation'
55
55
 
56
56
  before do
57
+ @locale = I18n.locale
57
58
  I18n.locale = :en
58
59
  end
60
+
61
+ after { I18n.locale = @locale }
59
62
  end
60
63
 
61
64
  context 'hsilgne' do
@@ -75,7 +78,10 @@ describe I18nInteraction do
75
78
  }
76
79
  )
77
80
 
81
+ @locale = I18n.locale
78
82
  I18n.locale = 'hsilgne'
79
83
  end
84
+
85
+ after { I18n.locale = @locale }
80
86
  end
81
87
  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.2.4
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Lasseigne
@@ -9,110 +9,110 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-08-07 00:00:00.000000000 Z
12
+ date: 2014-08-15 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.2'
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.2'
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.6'
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.6'
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: guard-rubocop
78
78
  requirement: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ~>
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.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: '1.1'
90
90
  - !ruby/object:Gem::Dependency
91
91
  name: rake
92
92
  requirement: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ~>
95
95
  - !ruby/object:Gem::Version
96
96
  version: '10.3'
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: '10.3'
104
104
  - !ruby/object:Gem::Dependency
105
105
  name: rdoc
106
106
  requirement: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ~>
109
109
  - !ruby/object:Gem::Version
110
110
  version: '4.1'
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: '4.1'
118
118
  - !ruby/object:Gem::Dependency
@@ -133,14 +133,14 @@ dependencies:
133
133
  name: yard
134
134
  requirement: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - "~>"
136
+ - - ~>
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0.8'
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
145
  version: '0.8'
146
146
  - !ruby/object:Gem::Dependency
@@ -165,10 +165,6 @@ executables: []
165
165
  extensions: []
166
166
  extra_rdoc_files: []
167
167
  files:
168
- - CHANGELOG.md
169
- - LICENSE.txt
170
- - README.md
171
- - lib/active_interaction.rb
172
168
  - lib/active_interaction/backports.rb
173
169
  - lib/active_interaction/base.rb
174
170
  - lib/active_interaction/concerns/active_modelable.rb
@@ -196,10 +192,10 @@ files:
196
192
  - lib/active_interaction/filters/symbol_filter.rb
197
193
  - lib/active_interaction/filters/time_filter.rb
198
194
  - lib/active_interaction/grouped_input.rb
199
- - lib/active_interaction/locale/en.yml
200
195
  - lib/active_interaction/modules/input_processor.rb
201
196
  - lib/active_interaction/modules/validation.rb
202
197
  - lib/active_interaction/version.rb
198
+ - lib/active_interaction.rb
203
199
  - spec/active_interaction/base_spec.rb
204
200
  - spec/active_interaction/concerns/active_modelable_spec.rb
205
201
  - spec/active_interaction/concerns/hashable_spec.rb
@@ -245,6 +241,10 @@ files:
245
241
  - spec/support/concerns.rb
246
242
  - spec/support/filters.rb
247
243
  - spec/support/interactions.rb
244
+ - CHANGELOG.md
245
+ - LICENSE.txt
246
+ - README.md
247
+ - lib/active_interaction/locale/en.yml
248
248
  homepage: http://orgsync.github.io/active_interaction/
249
249
  licenses:
250
250
  - MIT
@@ -255,17 +255,17 @@ require_paths:
255
255
  - lib
256
256
  required_ruby_version: !ruby/object:Gem::Requirement
257
257
  requirements:
258
- - - ">="
258
+ - - '>='
259
259
  - !ruby/object:Gem::Version
260
260
  version: 1.9.3
261
261
  required_rubygems_version: !ruby/object:Gem::Requirement
262
262
  requirements:
263
- - - ">="
263
+ - - '>='
264
264
  - !ruby/object:Gem::Version
265
265
  version: '0'
266
266
  requirements: []
267
267
  rubyforge_project:
268
- rubygems_version: 2.4.1
268
+ rubygems_version: 2.0.14
269
269
  signing_key:
270
270
  specification_version: 4
271
271
  summary: Manage application specific business logic.