dynamic_controller 0.0.8 → 0.0.9
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.
- data/README.md +80 -80
- data/dynamic_controller.gemspec +27 -27
- data/lib/dynamic_controller/action_controller_extension.rb +18 -16
- data/lib/dynamic_controller/class_methods.rb +41 -41
- data/lib/dynamic_controller/helper_methods.rb +103 -91
- data/lib/dynamic_controller/instance_methods.rb +139 -139
- data/lib/dynamic_controller/resource.rb +21 -21
- data/lib/dynamic_controller/responder.rb +70 -70
- data/lib/dynamic_controller/version.rb +3 -3
- data/lib/dynamic_controller.rb +18 -18
- data/spec/controller_factory.rb +22 -22
- data/spec/controllers/crud_actions_html_spec.rb +111 -111
- data/spec/controllers/crud_actions_json_spec.rb +91 -91
- data/spec/controllers/nested_crud_actions_html_spec.rb +125 -125
- data/spec/controllers/nested_crud_actions_json_spec.rb +97 -97
- data/spec/controllers/ransack_spec.rb +57 -57
- data/spec/controllers/redefined_responders_html_spec.rb +111 -111
- data/spec/controllers/redefined_responders_json_spec.rb +94 -94
- data/spec/controllers/two_level_nested_crud_actions_html_spec.rb +133 -133
- data/spec/controllers/two_level_nested_crud_actions_json_spec.rb +97 -97
- data/spec/custom_responder_format_spec.rb +12 -12
- data/spec/dummy/Gemfile +13 -13
- data/spec/dummy/app/controllers/cities_controller.rb +95 -95
- data/spec/dummy/app/controllers/languages_controller.rb +95 -95
- data/spec/dummy/app/controllers/streets_controller.rb +97 -97
- data/spec/dummy/app/models/city.rb +6 -6
- data/spec/dummy/app/models/language.rb +4 -4
- data/spec/dummy/app/models/street.rb +5 -5
- data/spec/dummy/app/views/cities/_form.html.erb +25 -25
- data/spec/dummy/app/views/cities/index.html.erb +29 -29
- data/spec/dummy/app/views/countries/index.html.erb +25 -25
- data/spec/dummy/app/views/languages/_form.html.erb +21 -21
- data/spec/dummy/app/views/languages/edit.html.erb +6 -6
- data/spec/dummy/app/views/languages/index.html.erb +23 -23
- data/spec/dummy/app/views/languages/new.html.erb +5 -5
- data/spec/dummy/app/views/languages/show.html.erb +10 -10
- data/spec/dummy/app/views/streets/_form.html.erb +25 -25
- data/spec/dummy/app/views/streets/edit.html.erb +6 -6
- data/spec/dummy/app/views/streets/index.html.erb +27 -27
- data/spec/dummy/app/views/streets/new.html.erb +5 -5
- data/spec/dummy/app/views/streets/show.html.erb +15 -15
- data/spec/dummy/config/routes.rb +8 -8
- data/spec/dummy/db/migrate/20120922010743_create_languages.rb +9 -9
- data/spec/dummy/db/migrate/20120929185302_create_streets.rb +11 -11
- data/spec/dummy/db/schema.rb +46 -46
- data/spec/factories.rb +21 -21
- data/spec/has_crud_actions_options_spec.rb +48 -48
- data/spec/spec_helper.rb +35 -35
- metadata +58 -17
data/spec/factories.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
FactoryGirl.define do
|
2
|
-
|
3
|
-
factory :country do
|
4
|
-
sequence(:name) { |s| "Country #{s}" }
|
5
|
-
end
|
6
|
-
|
7
|
-
factory :city do
|
8
|
-
sequence(:name) { |s| "City #{s}" }
|
9
|
-
country
|
10
|
-
end
|
11
|
-
|
12
|
-
factory :street do
|
13
|
-
sequence(:name) { |s| "Street #{s}" }
|
14
|
-
city
|
15
|
-
end
|
16
|
-
|
17
|
-
factory :language do
|
18
|
-
sequence(:name) { |s| "Language #{s}" }
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
1
|
+
FactoryGirl.define do
|
2
|
+
|
3
|
+
factory :country do
|
4
|
+
sequence(:name) { |s| "Country #{s}" }
|
5
|
+
end
|
6
|
+
|
7
|
+
factory :city do
|
8
|
+
sequence(:name) { |s| "City #{s}" }
|
9
|
+
country
|
10
|
+
end
|
11
|
+
|
12
|
+
factory :street do
|
13
|
+
sequence(:name) { |s| "Street #{s}" }
|
14
|
+
city
|
15
|
+
end
|
16
|
+
|
17
|
+
factory :language do
|
18
|
+
sequence(:name) { |s| "Language #{s}" }
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -1,49 +1,49 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Crud actions options' do
|
4
|
-
|
5
|
-
it 'Respond to all actions' do
|
6
|
-
controller = AllActionsController.new
|
7
|
-
|
8
|
-
controller.should respond_to :index
|
9
|
-
controller.should respond_to :new
|
10
|
-
controller.should respond_to :edit
|
11
|
-
controller.should respond_to :create
|
12
|
-
controller.should respond_to :update
|
13
|
-
controller.should respond_to :destroy
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'Respond only to index action' do
|
17
|
-
controller = OnlyIndexController.new
|
18
|
-
|
19
|
-
controller.should respond_to :index
|
20
|
-
controller.should_not respond_to :new
|
21
|
-
controller.should_not respond_to :edit
|
22
|
-
controller.should_not respond_to :create
|
23
|
-
controller.should_not respond_to :update
|
24
|
-
controller.should_not respond_to :destroy
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'Respond to all actions except index' do
|
28
|
-
controller = ExceptIndexController.new
|
29
|
-
|
30
|
-
controller.should_not respond_to :index
|
31
|
-
controller.should respond_to :new
|
32
|
-
controller.should respond_to :edit
|
33
|
-
controller.should respond_to :create
|
34
|
-
controller.should respond_to :update
|
35
|
-
controller.should respond_to :destroy
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'Respond to combination actions' do
|
39
|
-
controller = OnlyAndExceptController.new
|
40
|
-
|
41
|
-
controller.should respond_to :index
|
42
|
-
controller.should respond_to :new
|
43
|
-
controller.should_not respond_to :edit
|
44
|
-
controller.should respond_to :create
|
45
|
-
controller.should_not respond_to :update
|
46
|
-
controller.should_not respond_to :destroy
|
47
|
-
end
|
48
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Crud actions options' do
|
4
|
+
|
5
|
+
it 'Respond to all actions' do
|
6
|
+
controller = AllActionsController.new
|
7
|
+
|
8
|
+
controller.should respond_to :index
|
9
|
+
controller.should respond_to :new
|
10
|
+
controller.should respond_to :edit
|
11
|
+
controller.should respond_to :create
|
12
|
+
controller.should respond_to :update
|
13
|
+
controller.should respond_to :destroy
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'Respond only to index action' do
|
17
|
+
controller = OnlyIndexController.new
|
18
|
+
|
19
|
+
controller.should respond_to :index
|
20
|
+
controller.should_not respond_to :new
|
21
|
+
controller.should_not respond_to :edit
|
22
|
+
controller.should_not respond_to :create
|
23
|
+
controller.should_not respond_to :update
|
24
|
+
controller.should_not respond_to :destroy
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'Respond to all actions except index' do
|
28
|
+
controller = ExceptIndexController.new
|
29
|
+
|
30
|
+
controller.should_not respond_to :index
|
31
|
+
controller.should respond_to :new
|
32
|
+
controller.should respond_to :edit
|
33
|
+
controller.should respond_to :create
|
34
|
+
controller.should respond_to :update
|
35
|
+
controller.should respond_to :destroy
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'Respond to combination actions' do
|
39
|
+
controller = OnlyAndExceptController.new
|
40
|
+
|
41
|
+
controller.should respond_to :index
|
42
|
+
controller.should respond_to :new
|
43
|
+
controller.should_not respond_to :edit
|
44
|
+
controller.should respond_to :create
|
45
|
+
controller.should_not respond_to :update
|
46
|
+
controller.should_not respond_to :destroy
|
47
|
+
end
|
48
|
+
|
49
49
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,35 +1,35 @@
|
|
1
|
-
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
-
ENV["RAILS_ENV"] ||= 'test'
|
3
|
-
require File.expand_path("../dummy/config/environment", __FILE__)
|
4
|
-
require 'rspec/rails'
|
5
|
-
require 'rspec/autorun'
|
6
|
-
require 'factory_girl'
|
7
|
-
require 'factories'
|
8
|
-
require 'controller_factory'
|
9
|
-
require 'json'
|
10
|
-
|
11
|
-
# Requires supporting ruby files with custom matchers and macros, etc,
|
12
|
-
# in spec/support/ and its subdirectories.
|
13
|
-
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
14
|
-
|
15
|
-
RSpec.configure do |config|
|
16
|
-
# ## Mock Framework
|
17
|
-
#
|
18
|
-
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
19
|
-
#
|
20
|
-
# config.mock_with :mocha
|
21
|
-
# config.mock_with :flexmock
|
22
|
-
# config.mock_with :rr
|
23
|
-
|
24
|
-
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
25
|
-
# examples within a transaction, remove the following line or assign false
|
26
|
-
# instead of true.
|
27
|
-
config.use_transactional_fixtures = true
|
28
|
-
|
29
|
-
# If true, the base class of anonymous controllers will be inferred
|
30
|
-
# automatically. This will be the default behavior in future versions of
|
31
|
-
# rspec-rails.
|
32
|
-
config.infer_base_class_for_anonymous_controllers = false
|
33
|
-
|
34
|
-
config.include FactoryGirl::Syntax::Methods
|
35
|
-
end
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
ENV["RAILS_ENV"] ||= 'test'
|
3
|
+
require File.expand_path("../dummy/config/environment", __FILE__)
|
4
|
+
require 'rspec/rails'
|
5
|
+
require 'rspec/autorun'
|
6
|
+
require 'factory_girl'
|
7
|
+
require 'factories'
|
8
|
+
require 'controller_factory'
|
9
|
+
require 'json'
|
10
|
+
|
11
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
12
|
+
# in spec/support/ and its subdirectories.
|
13
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
14
|
+
|
15
|
+
RSpec.configure do |config|
|
16
|
+
# ## Mock Framework
|
17
|
+
#
|
18
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
19
|
+
#
|
20
|
+
# config.mock_with :mocha
|
21
|
+
# config.mock_with :flexmock
|
22
|
+
# config.mock_with :rr
|
23
|
+
|
24
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
25
|
+
# examples within a transaction, remove the following line or assign false
|
26
|
+
# instead of true.
|
27
|
+
config.use_transactional_fixtures = true
|
28
|
+
|
29
|
+
# If true, the base class of anonymous controllers will be inferred
|
30
|
+
# automatically. This will be the default behavior in future versions of
|
31
|
+
# rspec-rails.
|
32
|
+
config.infer_base_class_for_anonymous_controllers = false
|
33
|
+
|
34
|
+
config.include FactoryGirl::Syntax::Methods
|
35
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynamic_controller
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-11-15 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ransack
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: kaminari
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,21 +37,31 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: nql
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
|
-
- - =
|
51
|
+
- - '='
|
42
52
|
- !ruby/object:Gem::Version
|
43
53
|
version: 0.0.4
|
44
54
|
type: :runtime
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.0.4
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: rails
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ! '>='
|
@@ -54,10 +69,15 @@ dependencies:
|
|
54
69
|
version: '0'
|
55
70
|
type: :development
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: sqlite3
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ! '>='
|
@@ -65,10 +85,15 @@ dependencies:
|
|
65
85
|
version: '0'
|
66
86
|
type: :development
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
69
94
|
- !ruby/object:Gem::Dependency
|
70
95
|
name: rspec-rails
|
71
|
-
requirement:
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
72
97
|
none: false
|
73
98
|
requirements:
|
74
99
|
- - ! '>='
|
@@ -76,10 +101,15 @@ dependencies:
|
|
76
101
|
version: '0'
|
77
102
|
type: :development
|
78
103
|
prerelease: false
|
79
|
-
version_requirements:
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
80
110
|
- !ruby/object:Gem::Dependency
|
81
111
|
name: factory_girl_rails
|
82
|
-
requirement:
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
83
113
|
none: false
|
84
114
|
requirements:
|
85
115
|
- - ! '>='
|
@@ -87,7 +117,12 @@ dependencies:
|
|
87
117
|
version: '0'
|
88
118
|
type: :development
|
89
119
|
prerelease: false
|
90
|
-
version_requirements:
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
91
126
|
description: Simple way to add CRUD actions into Rails controllers
|
92
127
|
email:
|
93
128
|
- gabynaiman@gmail.com
|
@@ -211,15 +246,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
211
246
|
- - ! '>='
|
212
247
|
- !ruby/object:Gem::Version
|
213
248
|
version: '0'
|
249
|
+
segments:
|
250
|
+
- 0
|
251
|
+
hash: 590422993
|
214
252
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
215
253
|
none: false
|
216
254
|
requirements:
|
217
255
|
- - ! '>='
|
218
256
|
- !ruby/object:Gem::Version
|
219
257
|
version: '0'
|
258
|
+
segments:
|
259
|
+
- 0
|
260
|
+
hash: 590422993
|
220
261
|
requirements: []
|
221
262
|
rubyforge_project:
|
222
|
-
rubygems_version: 1.8.
|
263
|
+
rubygems_version: 1.8.24
|
223
264
|
signing_key:
|
224
265
|
specification_version: 3
|
225
266
|
summary: Simple way to add CRUD actions into Rails controllers
|