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.
@@ -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
@@ -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
- @actions.each do |a|
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,4 +1,8 @@
1
1
  class Dinosaur < ActiveRecord::Base
2
2
 
3
+ extend SqlSearchableSortable
4
+
3
5
  sql_searchable :name #, :age, :good_dino
6
+
7
+ sql_sortable :name, :age, :good_dino
4
8
  end
@@ -1,19 +1,6 @@
1
- ---
1
+
2
2
  en:
3
- will_paginate:
4
- models:
5
- people:
6
- zero: People
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}&nbsp;-&nbsp;%{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&nbsp;%{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
- ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
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.0
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-21 00:00:00.000000000 Z
11
+ date: 2014-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails