controller_scaffolding 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/controller_scaffolding/version.rb +1 -1
- data/lib/generators/controller/controller_scaffolding_generator.rb +13 -4
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +10592 -0
- data/test/dummy/spec/requests/people_spec.rb +11 -2
- data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/lib/generators/all_actions_generator_test.rb +1 -2
- data/test/lib/generators/ext_controller_scaffolding_generator_test.rb +2 -0
- data/test/lib/tmp/app/models/dinosaur.rb +4 -0
- data/test/lib/tmp/config/locales/en.yml +5 -18
- data/test/test_helper.rb +4 -4
- metadata +2 -2
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe "People" do
|
4
4
|
before(:all) do
|
5
|
-
cmd_str = 'rails g controller_scaffolding people index new create edit update destroy'
|
5
|
+
cmd_str = 'rails g controller_scaffolding people index new create edit update destroy restless_action'
|
6
6
|
cmd_str << ' --template-engine=haml --quiet --force --skip-assets --skip-test-framework --skip-helper --skip-datepicker'
|
7
7
|
puts "\n#{cmd_str}"
|
8
8
|
%x(#{cmd_str})
|
@@ -13,7 +13,7 @@ describe "People" do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
after(:all) do
|
16
|
-
cmd_str = 'rails d controller_scaffolding people index new create edit update destroy'
|
16
|
+
cmd_str = 'rails d controller_scaffolding people index new create edit update destroy restless_action'
|
17
17
|
cmd_str << ' --template-engine=haml --quiet --force --skip-assets --skip-test-framework --skip-helper --skip-datepicker'
|
18
18
|
puts "\n#{cmd_str}"
|
19
19
|
%x(#{cmd_str})
|
@@ -285,5 +285,14 @@ describe "People" do
|
|
285
285
|
#TODO: it has the correct field types (may be tough to test)
|
286
286
|
end
|
287
287
|
|
288
|
+
#This is really more of a controller test to make sure the custom action was added, but I don't feel like
|
289
|
+
# adding any controller specs right now
|
290
|
+
describe "Restless Action" do
|
291
|
+
before { visit 'people/restless_action' }
|
292
|
+
it "renders the restless_action template which was generated by the view.html template" do
|
293
|
+
page.should have_content("Find me in app/views/people/restless_action.html.haml")
|
294
|
+
page.should have_content("(Generated by the view.html.haml controller_scaffolding template)")
|
295
|
+
end
|
296
|
+
end
|
288
297
|
|
289
298
|
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -9,7 +9,6 @@ class AllActionsGeneratorTest < Rails::Generators::TestCase
|
|
9
9
|
|
10
10
|
def setup
|
11
11
|
@contr_name = "people"
|
12
|
-
@actions = %w(index new create edit update destroy)
|
13
12
|
@opts = %w(--force --quiet --template-engine=haml)
|
14
13
|
@args = [@contr_name] | @opts #Not passing any actions in!
|
15
14
|
prepare_destination
|
@@ -29,7 +28,7 @@ class AllActionsGeneratorTest < Rails::Generators::TestCase
|
|
29
28
|
|
30
29
|
run_generator @args
|
31
30
|
assert_file "app/controllers/#{@contr_name}_controller.rb" do |p_ctrl|
|
32
|
-
|
31
|
+
%w(index new create edit update destroy).each do |a|
|
33
32
|
assert_instance_method a, p_ctrl do |action|
|
34
33
|
assert_match(/\.paginate\(per_page: @per_page, page: @page\)/, action) if a == "index"
|
35
34
|
end
|
@@ -41,12 +41,14 @@ class ExtControllerScaffoldingGeneratorTest < Rails::Generators::TestCase
|
|
41
41
|
|
42
42
|
test "Routes were added properly" do
|
43
43
|
assert_file "config/routes.rb" do |routes|
|
44
|
+
assert_no_match %r(get '#{@contr_name}/custom_action', to: '#{@contr_name}#custom_action'), routes
|
44
45
|
assert_no_match %r(resources :#{@contr_name}), routes
|
45
46
|
end
|
46
47
|
|
47
48
|
run_generator @args
|
48
49
|
|
49
50
|
assert_file "config/routes.rb" do |routes|
|
51
|
+
assert_match %r(get '#{@contr_name}/custom_action', to: '#{@contr_name}#custom_action'), routes
|
50
52
|
assert_match %r(resources :#{@contr_name}), routes
|
51
53
|
end
|
52
54
|
end
|
@@ -1,19 +1,6 @@
|
|
1
|
-
|
1
|
+
|
2
2
|
en:
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
one: Person
|
8
|
-
other: People
|
9
|
-
dinosaurs:
|
10
|
-
zero: Dinosaurs
|
11
|
-
one: Dinosaur
|
12
|
-
other: Dinosaurs
|
13
|
-
page_entries_info:
|
14
|
-
multi_page_html: Displaying <b>%{from} - %{to}</b> of <b>%{count}</b>
|
15
|
-
%{model}
|
16
|
-
single_page_html:
|
17
|
-
zero: No %{model} found
|
18
|
-
one: Displaying <b>1</b> %{model}
|
19
|
-
other: Displaying <b>all %{count}</b> %{model}
|
3
|
+
|
4
|
+
|
5
|
+
|
6
|
+
|
data/test/test_helper.rb
CHANGED
@@ -10,12 +10,12 @@ require 'generators/haml/controller/controller_scaffolding_generator'
|
|
10
10
|
Rails.backtrace_cleaner.remove_silencers!
|
11
11
|
|
12
12
|
# Load support files
|
13
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
13
|
+
#Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
14
14
|
|
15
15
|
# Load fixtures from the engine
|
16
|
-
if ActiveSupport::TestCase.method_defined?(:fixture_path=)
|
17
|
-
|
18
|
-
end
|
16
|
+
# if ActiveSupport::TestCase.method_defined?(:fixture_path=)
|
17
|
+
# ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
18
|
+
# end
|
19
19
|
|
20
20
|
#TODO: SHould add a helper for this to Rails::Generators::TestCase
|
21
21
|
# so you could do like: stage_rails_files("../dummy_test_files", "app", "config", ...)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: controller_scaffolding
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John O'Malley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|