class-action 1.2.2 → 1.3.0

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: cac0bed41739811988bfd6fed1bd3adcca10f1db
4
- data.tar.gz: ed39124aa5d0a234220a02a9b44d76e052b9c12c
3
+ metadata.gz: 67491f2d4f05fd11241fe72316be24fa55fc9518
4
+ data.tar.gz: 98af8db4cebf73ad4574a043fa2ef8cb4bb968e3
5
5
  SHA512:
6
- metadata.gz: 1653aa273f91adaefc456584189389502597b421900f9c3c5aca8801beb1a1dd5ef43d9534f9e9bbbde683e5e9b65f228aaaaf94805bd440b9e967ab5c7e9fda
7
- data.tar.gz: 7abea12a52f5531ac874becf208c0487f4177ca8f85904b7523d169149f56a5bb220fcc4901c4c23fe79f4582c57440b10000717de4dc9db53802a3d5852bbb0
6
+ metadata.gz: 7f0e565aaecce1dc7cf0c70a0c5bef3fcecca5cddb4f60659bc0c9eb758861453aa04fdf86da08bf2b31dc82a4b370831fdf7f9a808516f8a243126efcd1f2f4
7
+ data.tar.gz: a7441cf402af025f1130e092199f74f2403aba1e66b2773b52c67c665d72e636ae896c7a3c9c35052c5cf2ea96a70d05cfe6dc3d2cb61ba39db4d9d66b4099fa
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.3.0 ##
2
+
3
+ * Rename default actions class names to be suffixed with 'Action'.
4
+
1
5
  ## 1.1.0 ##
2
6
 
3
7
  * Early class action resolution
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- class-action (1.2.1)
4
+ class-action (1.3.0)
5
5
  activesupport
6
6
 
7
7
  GEM
@@ -1,3 +1,3 @@
1
1
  module ClassAction
2
- VERSION = "1.2.2"
2
+ VERSION = "1.3.0"
3
3
  end
data/lib/class_action.rb CHANGED
@@ -24,7 +24,7 @@ module ClassAction
24
24
 
25
25
  def class_action(*actions, klass: nil)
26
26
  actions.each do |action|
27
- action_class = klass || const_get(action.to_s.camelize)
27
+ action_class = klass || const_get("#{action.to_s.camelize}Action")
28
28
  raise ArgumentError, "ClassAction does not support anonymous classes" if action_class.name.nil?
29
29
 
30
30
  class_eval <<-RUBY, __FILE__, __LINE__+1
@@ -4,7 +4,11 @@ require 'class_action/rspec'
4
4
  describe ClassAction::RSpec::HaveClassActionMatcher do
5
5
 
6
6
  class ClassActionTestController < ActionController::Base
7
- class Index < ClassAction::Action
7
+ class IndexAction < ClassAction::Action
8
+ end
9
+ class Index2Action < ClassAction::Action
10
+ end
11
+ class OtherIndex2Action < ClassAction::Action
8
12
  end
9
13
  end
10
14
 
@@ -52,16 +56,13 @@ describe ClassAction::RSpec::HaveClassActionMatcher do
52
56
 
53
57
  it "should fail if the controller's index action uses a different class" do
54
58
  ClassActionTestController.class_eval do
55
- class Index2 < ClassAction::Action
56
- end
57
-
58
- class_action :index2, Index2
59
+ class_action :index2, klass: ClassActionTestController::OtherIndex2Action
59
60
  end
60
61
 
61
- expect { expect(controller).to have_class_action(:index2).using_class(ClassActionTestController::Index) }.to \
62
+ expect { expect(controller).to have_class_action(:index2).using_class(ClassActionTestController::Index2Action) }.to \
62
63
  raise_error(
63
64
  RSpec::Expectations::ExpectationNotMetError,
64
- "expected action ClassActionTestController#index2 to use class ClassActionTestController::Index, but it used Index2"
65
+ "expected action ClassActionTestController#index2 to use class ClassActionTestController::Index2Action, but it used ClassActionTestController::OtherIndex2Action"
65
66
  )
66
67
  end
67
68
  end
@@ -14,10 +14,10 @@ describe ClassAction do
14
14
  @logger ||= Logger.new(STDOUT)
15
15
  end
16
16
 
17
- class Show < ClassAction::Action
17
+ class ShowAction < ClassAction::Action
18
18
  end
19
19
 
20
- class OtherShow < ClassAction::Action
20
+ class OtherShowAction < ClassAction::Action
21
21
  end
22
22
  end
23
23
  end
@@ -43,9 +43,9 @@ describe ClassAction do
43
43
 
44
44
  context "when executing the action" do
45
45
  let(:action) { action = double(:action, :_execute => nil) }
46
- before { expect(ClassActionTestController::Show).to receive(:new).with(controller).and_return(action) }
46
+ before { expect(ClassActionTestController::ShowAction).to receive(:new).with(controller).and_return(action) }
47
47
 
48
- it "should try to instantiate TestController::Show and execute it" do
48
+ it "should try to instantiate TestController::ShowAction and execute it" do
49
49
  expect(action).to receive(:_execute)
50
50
  controller.show
51
51
  end
@@ -71,13 +71,13 @@ describe ClassAction do
71
71
  context "giving another action class" do
72
72
  before do
73
73
  ClassActionTestController.class_eval do
74
- class_action :show, klass: ClassActionTestController::OtherShow
74
+ class_action :show, klass: ClassActionTestController::OtherShowAction
75
75
  end
76
76
  end
77
77
 
78
78
  it "should try to instantiate the given action class when executed" do
79
- action = ClassActionTestController::OtherShow.new(controller)
80
- expect(ClassActionTestController::OtherShow).to receive(:new).with(controller).and_return(action)
79
+ action = ClassActionTestController::OtherShowAction.new(controller)
80
+ expect(ClassActionTestController::OtherShowAction).to receive(:new).with(controller).and_return(action)
81
81
  controller.show
82
82
 
83
83
  expect(controller.class_action).to be(action)
@@ -89,7 +89,7 @@ describe ClassAction do
89
89
  describe "respond mime injection" do
90
90
 
91
91
  before do
92
- ClassActionTestController::Show.class_eval do
92
+ ClassActionTestController::ShowAction.class_eval do
93
93
  respond_to :html
94
94
  end
95
95
  end
@@ -160,7 +160,7 @@ describe ClassAction do
160
160
  end
161
161
 
162
162
  it "should leave everything alone if the class action has no responders" do
163
- allow(ClassActionTestController::Show).to receive(:_responders).and_return({})
163
+ allow(ClassActionTestController::ShowAction).to receive(:_responders).and_return({})
164
164
 
165
165
  ClassActionTestController.class_eval do
166
166
  respond_to :json
@@ -173,7 +173,7 @@ describe ClassAction do
173
173
  end
174
174
 
175
175
  it "should leave everything alone if the class action has an 'any' responder" do
176
- ClassActionTestController::Show.class_eval do
176
+ ClassActionTestController::ShowAction.class_eval do
177
177
  respond_to_any
178
178
  end
179
179
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: class-action
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joost Lubach
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-13 00:00:00.000000000 Z
11
+ date: 2014-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport