class-action 1.3.0 → 1.3.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 67491f2d4f05fd11241fe72316be24fa55fc9518
4
- data.tar.gz: 98af8db4cebf73ad4574a043fa2ef8cb4bb968e3
3
+ metadata.gz: d42f5e13fe369f5658137e5442ad8074827a6093
4
+ data.tar.gz: 1ffcc823623757e1cc509831f7bb834c436112ac
5
5
  SHA512:
6
- metadata.gz: 7f0e565aaecce1dc7cf0c70a0c5bef3fcecca5cddb4f60659bc0c9eb758861453aa04fdf86da08bf2b31dc82a4b370831fdf7f9a808516f8a243126efcd1f2f4
7
- data.tar.gz: a7441cf402af025f1130e092199f74f2403aba1e66b2773b52c67c665d72e636ae896c7a3c9c35052c5cf2ea96a70d05cfe6dc3d2cb61ba39db4d9d66b4099fa
6
+ metadata.gz: ab77feaaaf6fad427084fdcb666d25b409fd4aa6e54b46a4552f6d0999a5eac3255e1d08fee98a6f9172134c37ec080c754be7e481e4324554eb3d454ad61251
7
+ data.tar.gz: 12656d677d4f7c26dfc045d167826a20474b5bc2abb9171092aa4fbf48b100c82394020e6248c6bb1514c4a144d7cf2f21d5d23f0bfd006c8550fd42c2493d52
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.3.1 ##
2
+
3
+ * Upgrade to Rails 4.1 and RSpec 3.1
4
+
1
5
  ## 1.3.0 ##
2
6
 
3
7
  * Rename default actions class names to be suffixed with 'Action'.
data/Gemfile.lock CHANGED
@@ -7,54 +7,61 @@ PATH
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actionpack (4.0.3)
11
- activesupport (= 4.0.3)
12
- builder (~> 3.1.0)
13
- erubis (~> 2.7.0)
10
+ actionpack (4.1.6)
11
+ actionview (= 4.1.6)
12
+ activesupport (= 4.1.6)
14
13
  rack (~> 1.5.2)
15
14
  rack-test (~> 0.6.2)
16
- activesupport (4.0.3)
17
- i18n (~> 0.6, >= 0.6.4)
18
- minitest (~> 4.2)
19
- multi_json (~> 1.3)
15
+ actionview (4.1.6)
16
+ activesupport (= 4.1.6)
17
+ builder (~> 3.1)
18
+ erubis (~> 2.7.0)
19
+ activesupport (4.1.6)
20
+ i18n (~> 0.6, >= 0.6.9)
21
+ json (~> 1.7, >= 1.7.7)
22
+ minitest (~> 5.1)
20
23
  thread_safe (~> 0.1)
21
- tzinfo (~> 0.3.37)
22
- atomic (1.1.15)
23
- builder (3.1.4)
24
+ tzinfo (~> 1.1)
25
+ builder (3.2.2)
24
26
  diff-lcs (1.2.5)
25
- docile (1.1.3)
27
+ docile (1.1.5)
26
28
  erubis (2.7.0)
27
- i18n (0.6.9)
28
- minitest (4.7.5)
29
- multi_json (1.9.0)
29
+ i18n (0.6.11)
30
+ json (1.8.1)
31
+ minitest (5.4.2)
32
+ multi_json (1.10.1)
30
33
  rack (1.5.2)
31
34
  rack-test (0.6.2)
32
35
  rack (>= 1.0)
33
- rake (10.1.1)
34
- rspec (2.14.1)
35
- rspec-core (~> 2.14.0)
36
- rspec-expectations (~> 2.14.0)
37
- rspec-mocks (~> 2.14.0)
38
- rspec-core (2.14.8)
39
- rspec-expectations (2.14.5)
40
- diff-lcs (>= 1.1.3, < 2.0)
41
- rspec-mocks (2.14.6)
42
- simplecov (0.8.2)
36
+ rake (10.3.2)
37
+ rspec (3.1.0)
38
+ rspec-core (~> 3.1.0)
39
+ rspec-expectations (~> 3.1.0)
40
+ rspec-mocks (~> 3.1.0)
41
+ rspec-core (3.1.6)
42
+ rspec-support (~> 3.1.0)
43
+ rspec-expectations (3.1.2)
44
+ diff-lcs (>= 1.2.0, < 2.0)
45
+ rspec-support (~> 3.1.0)
46
+ rspec-mocks (3.1.3)
47
+ rspec-support (~> 3.1.0)
48
+ rspec-support (3.1.2)
49
+ simplecov (0.9.1)
43
50
  docile (~> 1.1.0)
44
- multi_json
51
+ multi_json (~> 1.0)
45
52
  simplecov-html (~> 0.8.0)
46
53
  simplecov-html (0.8.0)
47
- thread_safe (0.2.0)
48
- atomic (>= 1.1.7, < 2)
49
- tzinfo (0.3.39)
54
+ thread_safe (0.3.4)
55
+ tzinfo (1.2.2)
56
+ thread_safe (~> 0.1)
50
57
 
51
58
  PLATFORMS
52
59
  ruby
53
60
 
54
61
  DEPENDENCIES
55
- actionpack
62
+ actionpack (~> 4.1)
56
63
  bundler (~> 1.3)
57
64
  class-action!
58
65
  rake
59
- rspec (~> 2.14)
66
+ rspec (~> 3.1)
60
67
  simplecov
data/class-action.gemspec CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.3"
24
24
  spec.add_development_dependency "rake"
25
- spec.add_development_dependency "rspec", "~> 2.14"
25
+ spec.add_development_dependency "rspec", "~> 3.1"
26
26
  spec.add_development_dependency "simplecov"
27
- spec.add_development_dependency "actionpack"
27
+ spec.add_development_dependency "actionpack", "~> 4.1"
28
28
  end
@@ -20,11 +20,11 @@ module ClassAction
20
20
  def controller
21
21
  @_controller
22
22
  end
23
+ protected :controller
23
24
 
24
25
  def available?
25
26
  true
26
27
  end
27
- protected :controller, :available?
28
28
 
29
29
  ######
30
30
  # Controller method exposure
@@ -67,7 +67,7 @@ module ClassAction
67
67
 
68
68
  def _action_methods
69
69
  methods = public_instance_methods
70
- methods -= [ :_execute ]
70
+ methods -= [ :_execute, :available? ]
71
71
  methods -= Object.public_instance_methods
72
72
  methods
73
73
  end
@@ -34,7 +34,7 @@ module ClassAction
34
34
  end
35
35
  end
36
36
 
37
- def failure_message_for_should
37
+ def failure_message
38
38
  case @reason
39
39
  when :unsupported
40
40
  "expected controller of class #{@controller.class} to have class action :#{@action_name}, but it does not support class actions"
@@ -47,7 +47,7 @@ module ClassAction
47
47
  end
48
48
  end
49
49
 
50
- def failure_message_for_should_not
50
+ def failure_message_when_negated
51
51
  if @klass
52
52
  "expected #{@controller.class}##{@action_name} not to be a class action using class #{@klass}"
53
53
  else
@@ -41,7 +41,7 @@ module ClassAction
41
41
  end
42
42
  end
43
43
 
44
- def failure_message_for_should
44
+ def failure_message
45
45
  if @condition
46
46
  "expected action of class #{@action.class} to respond to format :#{@format} on :#{@condition}"
47
47
  else
@@ -49,7 +49,7 @@ module ClassAction
49
49
  end
50
50
  end
51
51
 
52
- def failure_message_for_should_not
52
+ def failure_message_when_negated
53
53
  if @condition
54
54
  "expected action of class #{@action.class} not to respond to format :#{@format} on :#{@condition}"
55
55
  else
@@ -26,7 +26,7 @@ module ClassAction
26
26
  end
27
27
  end
28
28
 
29
- def failure_message_for_should
29
+ def failure_message
30
30
  suffix = if @actual
31
31
  ", but it responds with :#{@actual}"
32
32
  else
@@ -40,7 +40,7 @@ module ClassAction
40
40
  end
41
41
  end
42
42
 
43
- def failure_message_for_should_not
43
+ def failure_message_when_negated
44
44
  if @condition
45
45
  "expected action of class #{@action.class} not to respond with :#{@expected} on :#{@condition}"
46
46
  else
@@ -1,3 +1,3 @@
1
1
  module ClassAction
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.1"
3
3
  end
data/lib/class_action.rb CHANGED
@@ -109,6 +109,10 @@ module ClassAction
109
109
  view_context
110
110
  end
111
111
 
112
+ def _protected_ivars # :nodoc:
113
+ super + %i(@_class_action)
114
+ end
115
+
112
116
  private
113
117
 
114
118
  def _class_action
@@ -117,9 +121,5 @@ module ClassAction
117
121
 
118
122
  end
119
123
 
120
- if defined?(AbstractController::Rendering::DEFAULT_PROTECTED_INSTANCE_VARIABLES)
121
- AbstractController::Rendering::DEFAULT_PROTECTED_INSTANCE_VARIABLES << :@_class_action
122
- end
123
-
124
124
  require 'class_action/version'
125
125
  require 'class_action/action'
@@ -69,7 +69,7 @@ describe ClassAction::Action do
69
69
 
70
70
  it "should make the action respond to :load_post, but protectedly" do
71
71
  expect(action).not_to respond_to(:load_post)
72
- expect(action.respond_to?(:load_post, true)).to be_true # matcher doesn't work with second argument
72
+ expect(action.respond_to?(:load_post, true)).to be_truthy # matcher doesn't work with second argument
73
73
  end
74
74
 
75
75
  it "should pass the method :load_post on to the controller" do
@@ -427,9 +427,7 @@ describe ClassAction::Action do
427
427
  end
428
428
 
429
429
  action_subclass = Class.new(action_class)
430
- expect(action_subclass).to have(1)._response
431
- expect(action_subclass._responses.keys[0]).to be_nil
432
- expect(action_subclass._responses.values[0]).to be(:post)
430
+ expect(action_subclass._responses).to match({nil => :post})
433
431
  end
434
432
 
435
433
  end
@@ -40,7 +40,7 @@ describe ClassAction::RSpec::RespondToFormatMatcher do
40
40
  expect(action).to respond_to_format(:json) do
41
41
  called = true
42
42
  end
43
- expect(called).to be_true
43
+ expect(called).to be_truthy
44
44
  end
45
45
 
46
46
  it "should first execute the response block for a given format" do
@@ -50,7 +50,7 @@ describe ClassAction::RSpec::RespondToFormatMatcher do
50
50
  expect(action).to respond_to_format(:html) do
51
51
  response_block_called = controller.instance_variable_get('@responded_to_html')
52
52
  end
53
- expect(response_block_called).to be_true
53
+ expect(response_block_called).to be_truthy
54
54
  end
55
55
 
56
56
  end
@@ -96,7 +96,7 @@ describe ClassAction do
96
96
 
97
97
  it "should create mimes with :only => 'show' for nonexisting mimes" do
98
98
  ClassActionTestController.class_eval { class_action :show }
99
- ClassActionTestController.mimes_for_respond_to.should eql(
99
+ expect(ClassActionTestController.mimes_for_respond_to).to eql(
100
100
  :html => {:only => %w[show]}
101
101
  )
102
102
  end
@@ -107,7 +107,7 @@ describe ClassAction do
107
107
  class_action :show
108
108
  end
109
109
 
110
- ClassActionTestController.mimes_for_respond_to.should eql(
110
+ expect(ClassActionTestController.mimes_for_respond_to).to eql(
111
111
  :html => {:only => %w[index show]}
112
112
  )
113
113
  end
@@ -118,7 +118,7 @@ describe ClassAction do
118
118
  class_action :show
119
119
  end
120
120
 
121
- ClassActionTestController.mimes_for_respond_to.should eql(
121
+ expect(ClassActionTestController.mimes_for_respond_to).to eql(
122
122
  :html => {}
123
123
  )
124
124
  end
@@ -129,7 +129,7 @@ describe ClassAction do
129
129
  class_action :show
130
130
  end
131
131
 
132
- ClassActionTestController.mimes_for_respond_to.should eql(
132
+ expect(ClassActionTestController.mimes_for_respond_to).to eql(
133
133
  :html => { :only => %w[show] }
134
134
  )
135
135
  end
@@ -142,7 +142,7 @@ describe ClassAction do
142
142
  class_action :show
143
143
  end
144
144
 
145
- ClassActionTestController.mimes_for_respond_to.should eql(
145
+ expect(ClassActionTestController.mimes_for_respond_to).to eql(
146
146
  :html => { :except => %w[show] }
147
147
  )
148
148
  end
@@ -153,7 +153,7 @@ describe ClassAction do
153
153
  class_action :show
154
154
  end
155
155
 
156
- ClassActionTestController.mimes_for_respond_to.should eql(
156
+ expect(ClassActionTestController.mimes_for_respond_to).to eql(
157
157
  :html => { :only => %w[show] },
158
158
  :json => { :except => %w[show] }
159
159
  )
@@ -167,7 +167,7 @@ describe ClassAction do
167
167
  class_action :show
168
168
  end
169
169
 
170
- ClassActionTestController.mimes_for_respond_to.should eql(
170
+ expect(ClassActionTestController.mimes_for_respond_to).to eql(
171
171
  :json => {}
172
172
  )
173
173
  end
@@ -182,7 +182,7 @@ describe ClassAction do
182
182
  class_action :show
183
183
  end
184
184
 
185
- ClassActionTestController.mimes_for_respond_to.should eql(
185
+ expect(ClassActionTestController.mimes_for_respond_to).to eql(
186
186
  :json => {}
187
187
  )
188
188
  end
data/spec/spec_helper.rb CHANGED
@@ -6,7 +6,6 @@ end
6
6
 
7
7
  require 'action_controller'
8
8
  require 'class-action'
9
- require 'rspec/autorun'
10
9
 
11
10
  RSpec.configure do |config|
12
11
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: class-action
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joost Lubach
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: '2.14'
61
+ version: '3.1'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ~>
67
67
  - !ruby/object:Gem::Version
68
- version: '2.14'
68
+ version: '3.1'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: simplecov
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -84,16 +84,16 @@ dependencies:
84
84
  name: actionpack
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ~>
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: '4.1'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ~>
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: '4.1'
97
97
  description: Allows you to write controller actions as classes, rather than methods.
98
98
  email:
99
99
  - joost@yoazt.com