minitest-rails 0.9.2 → 1.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +14 -16
- data/Gemfile +7 -0
- data/Manifest.txt +12 -9
- data/README.rdoc +13 -1
- data/Rakefile +6 -5
- data/gemfiles/3.0.gemfile +2 -5
- data/gemfiles/3.1.gemfile +2 -5
- data/gemfiles/3.2.gemfile +2 -5
- data/gemfiles/4.0.gemfile +2 -6
- data/lib/generators/.document +0 -0
- data/lib/generators/mini_test/controller/templates/controller_spec.rb +3 -3
- data/lib/generators/mini_test/controller/templates/controller_test.rb +4 -4
- data/lib/generators/mini_test/helper/templates/helper_test.rb +1 -1
- data/lib/generators/mini_test/install/install_generator.rb +5 -0
- data/lib/generators/mini_test/install/templates/test_helper.rb +9 -0
- data/lib/generators/mini_test/integration/templates/integration_spec.rb +3 -3
- data/lib/generators/mini_test/integration/templates/integration_test.rb +3 -3
- data/lib/generators/mini_test/mailer/mailer_generator.rb +2 -2
- data/lib/generators/mini_test/mailer/templates/mailer_test.rb +4 -4
- data/lib/generators/mini_test/model/model_generator.rb +3 -3
- data/lib/generators/mini_test/model/templates/model_spec.rb +2 -4
- data/lib/generators/mini_test/model/templates/model_test.rb +9 -3
- data/lib/generators/mini_test/route/templates/route_spec.rb +1 -1
- data/lib/generators/mini_test/route/templates/route_test.rb +1 -1
- data/lib/generators/mini_test/scaffold/templates/controller_spec.rb +12 -14
- data/lib/generators/mini_test/scaffold/templates/controller_test.rb +6 -6
- data/lib/minitest/rails/assertions.rb +1811 -0
- data/lib/minitest/rails/expectations.rb +659 -0
- data/lib/minitest/rails/generators.rb +18 -0
- data/lib/minitest/rails/railtie.rb +1 -1
- data/lib/minitest/rails/tasks/.document +0 -0
- data/lib/minitest/rails/tasks/minitest.rake +44 -13
- data/lib/minitest/rails/testing.rb +10 -20
- data/lib/minitest/rails/version.rb +1 -1
- data/lib/minitest/rails.rb +22 -3
- data/minitest-rails.gemspec +21 -16
- data/tasks/test.rake +27 -15
- data/test/generators/test_install_generator.rb +17 -0
- data/test/generators/test_mailer_generator.rb +19 -0
- data/test/generators/test_model_generator.rb +25 -1
- data/test/helper.rb +27 -0
- data/test/rails/action_controller/test_assertions.rb +46 -0
- data/test/rails/action_controller/test_controllers.rb +2 -13
- data/test/rails/action_controller/test_expectations.rb +45 -0
- data/test/rails/active_support/test_assertions.rb +59 -0
- data/test/rails/active_support/test_expectations.rb +49 -0
- data/test/rails/generators/test_spec_type.rb +36 -0
- data/test/rails/minitest_5_api_test.rb +8 -0
- metadata +66 -54
- data/gemfiles/3.0.gemfile.lock +0 -91
- data/gemfiles/3.1.gemfile.lock +0 -102
- data/gemfiles/3.2.gemfile.lock +0 -101
- data/gemfiles/4.0.gemfile.lock +0 -99
- data/lib/autotest/discover.rb +0 -5
- data/lib/autotest/fixtures.rb +0 -7
- data/lib/autotest/migrate.rb +0 -5
- data/lib/autotest/minitest_rails.rb +0 -63
- data/tasks/gemfiles.rake +0 -24
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b5f87e7032f8578fdc6543551231f08849a377be
|
4
|
+
data.tar.gz: 263f20f6ba31323cdedad548ab6e4690876e5715
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 31bdd76b8d6329b0b7f64c5a92e772969a3b2128839b4cd331dd045b0afcbf2dced8f40eaf209ef57e8b00d7e2bdf3cce8c5e24220ce4464b1817d98a4264be8
|
7
|
+
data.tar.gz: 44c812ec2e71d3fdeb1d324efd113e043f56d2e0f29ae3a5a17167898eab6def9be5a589371d790ea51017cc02bcf7061ee9c9663fc06e6e5cb9da8d927c2186
|
data/.travis.yml
CHANGED
@@ -1,24 +1,22 @@
|
|
1
1
|
---
|
2
2
|
before_install:
|
3
|
-
- gem
|
4
|
-
-
|
5
|
-
|
6
|
-
- rake travis:before -t
|
3
|
+
- gem update --system
|
4
|
+
- gem --version
|
5
|
+
- ruby gemfiles/minitest_tu_shim.rb
|
7
6
|
language: ruby
|
8
7
|
notifications:
|
9
8
|
email:
|
10
|
-
|
9
|
+
- mike@blowmage.com
|
11
10
|
rvm:
|
12
|
-
-
|
13
|
-
- 1.9.3
|
14
|
-
-
|
15
|
-
|
16
|
-
-
|
17
|
-
-
|
18
|
-
-
|
19
|
-
-
|
20
|
-
script: rake travis
|
11
|
+
- 2.0.0
|
12
|
+
- 1.9.3
|
13
|
+
- 1.8.7
|
14
|
+
env:
|
15
|
+
- "RAILS_VERSION=4.0"
|
16
|
+
- "RAILS_VERSION=3.2"
|
17
|
+
- "RAILS_VERSION=3.1"
|
18
|
+
- "RAILS_VERSION=3.0"
|
21
19
|
matrix:
|
22
20
|
exclude:
|
23
|
-
|
24
|
-
|
21
|
+
- rvm: 1.8.7
|
22
|
+
env: "RAILS_VERSION=4.0"
|
data/Gemfile
ADDED
data/Manifest.txt
CHANGED
@@ -2,23 +2,17 @@
|
|
2
2
|
.gemtest
|
3
3
|
.travis.yml
|
4
4
|
CHANGELOG.rdoc
|
5
|
+
Gemfile
|
5
6
|
LICENSE
|
6
7
|
Manifest.txt
|
7
8
|
README.rdoc
|
8
9
|
Rakefile
|
9
10
|
gemfiles/3.0.gemfile
|
10
|
-
gemfiles/3.0.gemfile.lock
|
11
11
|
gemfiles/3.1.gemfile
|
12
|
-
gemfiles/3.1.gemfile.lock
|
13
12
|
gemfiles/3.2.gemfile
|
14
|
-
gemfiles/3.2.gemfile.lock
|
15
13
|
gemfiles/4.0.gemfile
|
16
|
-
gemfiles/4.0.gemfile.lock
|
17
14
|
gemfiles/minitest_tu_shim.rb
|
18
|
-
lib/
|
19
|
-
lib/autotest/fixtures.rb
|
20
|
-
lib/autotest/migrate.rb
|
21
|
-
lib/autotest/minitest_rails.rb
|
15
|
+
lib/generators/.document
|
22
16
|
lib/generators/mini_test.rb
|
23
17
|
lib/generators/mini_test/controller/controller_generator.rb
|
24
18
|
lib/generators/mini_test/controller/templates/controller_spec.rb
|
@@ -46,19 +40,22 @@ lib/generators/mini_test/scaffold/templates/controller_spec.rb
|
|
46
40
|
lib/generators/mini_test/scaffold/templates/controller_test.rb
|
47
41
|
lib/minitest-rails.rb
|
48
42
|
lib/minitest/rails.rb
|
43
|
+
lib/minitest/rails/assertions.rb
|
49
44
|
lib/minitest/rails/constant_lookup.rb
|
50
45
|
lib/minitest/rails/deprecated/action_controller.rb
|
51
46
|
lib/minitest/rails/deprecated/action_dispatch.rb
|
52
47
|
lib/minitest/rails/deprecated/action_mailer.rb
|
53
48
|
lib/minitest/rails/deprecated/action_view.rb
|
54
49
|
lib/minitest/rails/deprecated/active_support.rb
|
50
|
+
lib/minitest/rails/expectations.rb
|
51
|
+
lib/minitest/rails/generators.rb
|
55
52
|
lib/minitest/rails/railtie.rb
|
53
|
+
lib/minitest/rails/tasks/.document
|
56
54
|
lib/minitest/rails/tasks/minitest.rake
|
57
55
|
lib/minitest/rails/tasks/sub_test_task.rb
|
58
56
|
lib/minitest/rails/testing.rb
|
59
57
|
lib/minitest/rails/version.rb
|
60
58
|
minitest-rails.gemspec
|
61
|
-
tasks/gemfiles.rake
|
62
59
|
tasks/test.rake
|
63
60
|
test/generators/test_controller_generator.rb
|
64
61
|
test/generators/test_helper_generator.rb
|
@@ -68,13 +65,19 @@ test/generators/test_model_generator.rb
|
|
68
65
|
test/generators/test_route_generator.rb
|
69
66
|
test/generators/test_scaffold_generator.rb
|
70
67
|
test/helper.rb
|
68
|
+
test/rails/action_controller/test_assertions.rb
|
71
69
|
test/rails/action_controller/test_controllers.rb
|
70
|
+
test/rails/action_controller/test_expectations.rb
|
72
71
|
test/rails/action_controller/test_spec_type.rb
|
73
72
|
test/rails/action_dispatch/test_spec_type.rb
|
74
73
|
test/rails/action_mailer/test_mailers.rb
|
75
74
|
test/rails/action_mailer/test_spec_type.rb
|
76
75
|
test/rails/action_view/test_helpers.rb
|
77
76
|
test/rails/action_view/test_spec_type.rb
|
77
|
+
test/rails/active_support/test_assertions.rb
|
78
|
+
test/rails/active_support/test_expectations.rb
|
78
79
|
test/rails/active_support/test_spec_type.rb
|
80
|
+
test/rails/generators/test_spec_type.rb
|
81
|
+
test/rails/minitest_5_api_test.rb
|
79
82
|
test/rails/test_constant_lookup.rb
|
80
83
|
test/test_sanity.rb
|
data/README.rdoc
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
MiniTest integration for Rails 3 and 4
|
4
4
|
|
5
5
|
{<img src="https://secure.travis-ci.org/blowmage/minitest-rails.png" alt="Build Status" />}[http://travis-ci.org/blowmage/minitest-rails]
|
6
|
-
{<img src="https://codeclimate.com/
|
6
|
+
{<img src="https://codeclimate.com/github/blowmage/minitest-rails.png" />}[https://codeclimate.com/github/blowmage/minitest-rails]
|
7
7
|
|
8
8
|
== Install
|
9
9
|
|
@@ -50,6 +50,14 @@ You can also set these as defaults by adding the following to the <tt>config/app
|
|
50
50
|
config.generators do |g|
|
51
51
|
g.test_framework :mini_test, :spec => true, :fixture => false
|
52
52
|
end
|
53
|
+
|
54
|
+
To run your tests, minitest-rails provides multiple rake tasks by default, for a complete list, simply run <tt>rake -T</tt>.
|
55
|
+
|
56
|
+
You can also add any directories under <tt>test/</tt> and minitest-rails will automatically create the associated rake task for it. So let say you add a <tt>test/api/</tt> directory, <tt>rake minitest:api</tt> will automagically be available.
|
57
|
+
|
58
|
+
If you want to automatically run <tt>rake minitest:api</tt> when you call <tt>rake minitest</tt>, add this line to a new .rake file under <tt>lib/tasks/</tt>:
|
59
|
+
|
60
|
+
MiniTest::Rails::Testing.default_tasks << 'api'
|
53
61
|
|
54
62
|
== Running on Ruby 1.8
|
55
63
|
|
@@ -67,6 +75,10 @@ The 0.9 release marks a new direction for minitest-rails. Deprecations have been
|
|
67
75
|
|
68
76
|
Existing tests that call <tt>describe</tt> will not work, since <tt>describe</tt> is used by <tt>MiniTest::Spec</tt> blocks.
|
69
77
|
|
78
|
+
RSpec and minitest's spec DSL are incompatible and cannot both be loaded at the same time. If your tests using the spec DSL are not running it is likely the RSpec DSL is also loaded. Check the dependencies and make sure RSpec is only loaded when running the specs.
|
79
|
+
|
80
|
+
If you need to use some RSpec features with minitest-rails require only the needed gems. e.g. To use RSpec mocks with minitest-rails require the "rspec-mocks" gem only, and not the main "rspec" gem which activates the RSpec DSL.
|
81
|
+
|
70
82
|
== Get Involved
|
71
83
|
|
72
84
|
Join the mailing list to get help or offer suggestions.
|
data/Rakefile
CHANGED
@@ -5,8 +5,6 @@ require 'hoe'
|
|
5
5
|
|
6
6
|
Hoe.plugin :git
|
7
7
|
Hoe.plugin :gemspec
|
8
|
-
Hoe.plugin :travis
|
9
|
-
Hoe.plugins.delete :rubyforge
|
10
8
|
|
11
9
|
Hoe.spec 'minitest-rails' do
|
12
10
|
developer 'Mike Moore', 'mike@blowmage.com'
|
@@ -19,9 +17,12 @@ Hoe.spec 'minitest-rails' do
|
|
19
17
|
self.readme_file = "README.rdoc"
|
20
18
|
self.testlib = :minitest
|
21
19
|
|
22
|
-
|
23
|
-
|
24
|
-
dependency '
|
20
|
+
license "MIT"
|
21
|
+
|
22
|
+
dependency 'minitest', '~> 4.7'
|
23
|
+
dependency 'minitest-test', '~> 1.0'
|
24
|
+
dependency 'railties', '>= 3.0'
|
25
|
+
dependency 'fakefs', '~> 0.4', :dev
|
25
26
|
end
|
26
27
|
|
27
28
|
Dir["tasks/**/*.rake"].each { |t| load t }
|
data/gemfiles/3.0.gemfile
CHANGED
data/gemfiles/3.1.gemfile
CHANGED
data/gemfiles/3.2.gemfile
CHANGED
data/gemfiles/4.0.gemfile
CHANGED
File without changes
|
@@ -3,9 +3,9 @@ require "test_helper"
|
|
3
3
|
<% module_namespacing do -%>
|
4
4
|
describe <%= class_name %>Controller do
|
5
5
|
<% if actions.empty? -%>
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
it "must be a real test" do
|
7
|
+
flunk "Need real tests"
|
8
|
+
end
|
9
9
|
<% else -%>
|
10
10
|
<% actions.each do |action| -%>
|
11
11
|
it "should get <%= action %>" do
|
@@ -3,12 +3,12 @@ require "test_helper"
|
|
3
3
|
<% module_namespacing do -%>
|
4
4
|
class <%= class_name %>ControllerTest < ActionController::TestCase
|
5
5
|
<% if actions.empty? -%>
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
def test_sanity
|
7
|
+
flunk "Need real tests"
|
8
|
+
end
|
9
9
|
<% else -%>
|
10
10
|
<% actions.each do |action| -%>
|
11
|
-
|
11
|
+
def test_<%= action %>
|
12
12
|
get :<%= action %>
|
13
13
|
assert_response :success
|
14
14
|
end
|
@@ -3,6 +3,7 @@ require 'rails/generators'
|
|
3
3
|
module MiniTest
|
4
4
|
module Generators
|
5
5
|
class InstallGenerator < ::Rails::Generators::Base
|
6
|
+
class_option :active_record, :type => :boolean, :default => true, :desc => "Add ActiveRecord configuration"
|
6
7
|
|
7
8
|
desc <<DESC
|
8
9
|
Description:
|
@@ -17,6 +18,10 @@ DESC
|
|
17
18
|
template 'test_helper.rb', File.join("test", "test_helper.rb")
|
18
19
|
end
|
19
20
|
|
21
|
+
def add_migration_check
|
22
|
+
::Rails::VERSION::STRING >= "4.0"
|
23
|
+
end
|
24
|
+
|
20
25
|
end
|
21
26
|
end
|
22
27
|
end
|
@@ -11,8 +11,17 @@ require "minitest/rails"
|
|
11
11
|
# require "minitest/pride"
|
12
12
|
|
13
13
|
class ActiveSupport::TestCase
|
14
|
+
<% if options[:active_record] -%>
|
15
|
+
<% if add_migration_check -%>
|
16
|
+
ActiveRecord::Migration.check_pending!
|
17
|
+
|
18
|
+
<% end -%>
|
14
19
|
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
20
|
+
#
|
21
|
+
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
22
|
+
# -- they do not yet inherit this setting
|
15
23
|
fixtures :all
|
16
24
|
|
25
|
+
<% end -%>
|
17
26
|
# Add more helper methods to be used by all tests here...
|
18
27
|
end
|
@@ -2,7 +2,7 @@ require "test_helper"
|
|
2
2
|
|
3
3
|
# To be handled correctly this spec must end with "Integration Test"
|
4
4
|
describe "<%= class_name %> Integration Test" do
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
it "must be a real test" do
|
6
|
+
flunk "Need real tests"
|
7
|
+
end
|
8
8
|
end
|
@@ -9,9 +9,9 @@ module MiniTest
|
|
9
9
|
|
10
10
|
def create_test_files
|
11
11
|
if options[:spec]
|
12
|
-
template "mailer_spec.rb", "test
|
12
|
+
template "mailer_spec.rb", File.join("test","mailers", class_path, "#{file_name}_test.rb")
|
13
13
|
else
|
14
|
-
template "mailer_test.rb", "test
|
14
|
+
template "mailer_test.rb", File.join("test","mailers", class_path, "#{file_name}_test.rb")
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -3,7 +3,7 @@ require "test_helper"
|
|
3
3
|
<% module_namespacing do -%>
|
4
4
|
class <%= class_name %>Test < ActionMailer::TestCase
|
5
5
|
<% actions.each do |action| -%>
|
6
|
-
|
6
|
+
def test_<%= action %>
|
7
7
|
mail = <%= class_name %>.<%= action %>
|
8
8
|
assert_equal <%= action.to_s.humanize.inspect %>, mail.subject
|
9
9
|
assert_equal ["to@example.org"], mail.to
|
@@ -13,9 +13,9 @@ class <%= class_name %>Test < ActionMailer::TestCase
|
|
13
13
|
|
14
14
|
<% end -%>
|
15
15
|
<% if actions.blank? -%>
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
def test_sanity
|
17
|
+
flunk "Need real tests"
|
18
|
+
end
|
19
19
|
<% end -%>
|
20
20
|
end
|
21
21
|
<% end -%>
|
@@ -10,9 +10,9 @@ module MiniTest
|
|
10
10
|
|
11
11
|
def create_test_file
|
12
12
|
if options[:spec]
|
13
|
-
template "model_spec.rb", "test
|
13
|
+
template "model_spec.rb", File.join("test","models", class_path, "#{file_name}_test.rb")
|
14
14
|
else
|
15
|
-
template "model_test.rb", "test
|
15
|
+
template "model_test.rb", File.join("test","models", class_path, "#{file_name}_test.rb")
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -20,7 +20,7 @@ module MiniTest
|
|
20
20
|
|
21
21
|
def create_fixture_file
|
22
22
|
if options[:fixture] && options[:fixture_replacement].nil?
|
23
|
-
template "fixtures.yml", "test
|
23
|
+
template "fixtures.yml", File.join("test","fixtures", class_path, "#{plural_file_name}.yml")
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -2,12 +2,10 @@ require "test_helper"
|
|
2
2
|
|
3
3
|
<% module_namespacing do -%>
|
4
4
|
describe <%= class_name %> do
|
5
|
-
|
6
|
-
@<%= file_name %> = <%= class_name %>.new
|
7
|
-
end
|
5
|
+
let(:<%= file_name %>) { <%= class_name %>.new }
|
8
6
|
|
9
7
|
it "must be valid" do
|
10
|
-
|
8
|
+
<%= file_name %>.must_be :valid?
|
11
9
|
end
|
12
10
|
end
|
13
11
|
<% end -%>
|
@@ -2,8 +2,14 @@ require "test_helper"
|
|
2
2
|
|
3
3
|
<% module_namespacing do -%>
|
4
4
|
class <%= class_name %>Test < ActiveSupport::TestCase
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
|
6
|
+
def <%= file_name %>
|
7
|
+
@<%= file_name %> ||= <%= class_name %>.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_valid
|
11
|
+
assert <%= file_name %>.valid?
|
12
|
+
end
|
13
|
+
|
8
14
|
end
|
9
15
|
<% end -%>
|
@@ -3,22 +3,20 @@ require "test_helper"
|
|
3
3
|
<% module_namespacing do -%>
|
4
4
|
describe <%= controller_class_name %>Controller do
|
5
5
|
|
6
|
-
|
7
|
-
@<%= singular_table_name %> = <%= table_name %>(:one)
|
8
|
-
end
|
6
|
+
let(:<%= singular_table_name %>) { <%= table_name %> :one }
|
9
7
|
|
10
|
-
it "
|
8
|
+
it "gets index" do
|
11
9
|
get :index
|
12
10
|
assert_response :success
|
13
11
|
assert_not_nil assigns(:<%= table_name %>)
|
14
12
|
end
|
15
13
|
|
16
|
-
it "
|
14
|
+
it "gets new" do
|
17
15
|
get :new
|
18
16
|
assert_response :success
|
19
17
|
end
|
20
18
|
|
21
|
-
it "
|
19
|
+
it "creates <%= singular_table_name %>" do
|
22
20
|
assert_difference('<%= class_name %>.count') do
|
23
21
|
post :create, <%= "#{singular_table_name}: { #{attributes_hash} }" %>
|
24
22
|
end
|
@@ -26,24 +24,24 @@ describe <%= controller_class_name %>Controller do
|
|
26
24
|
assert_redirected_to <%= singular_table_name %>_path(assigns(:<%= singular_table_name %>))
|
27
25
|
end
|
28
26
|
|
29
|
-
it "
|
30
|
-
get :show, <%= key_value :id, "
|
27
|
+
it "shows <%= singular_table_name %>" do
|
28
|
+
get :show, <%= key_value :id, "#{singular_table_name}" %>
|
31
29
|
assert_response :success
|
32
30
|
end
|
33
31
|
|
34
|
-
it "
|
35
|
-
get :edit, <%= key_value :id, "
|
32
|
+
it "gets edit" do
|
33
|
+
get :edit, <%= key_value :id, "#{singular_table_name}" %>
|
36
34
|
assert_response :success
|
37
35
|
end
|
38
36
|
|
39
|
-
it "
|
40
|
-
put :update, <%= key_value :id, "
|
37
|
+
it "updates <%= singular_table_name %>" do
|
38
|
+
put :update, <%= key_value :id, "#{singular_table_name}" %>, <%= "#{singular_table_name}: { #{attributes_hash} }" %>
|
41
39
|
assert_redirected_to <%= singular_table_name %>_path(assigns(:<%= singular_table_name %>))
|
42
40
|
end
|
43
41
|
|
44
|
-
it "
|
42
|
+
it "destroys <%= singular_table_name %>" do
|
45
43
|
assert_difference('<%= class_name %>.count', -1) do
|
46
|
-
delete :destroy, <%= key_value :id, "
|
44
|
+
delete :destroy, <%= key_value :id, "#{singular_table_name}" %>
|
47
45
|
end
|
48
46
|
|
49
47
|
assert_redirected_to <%= index_helper %>_path
|
@@ -3,8 +3,8 @@ require "test_helper"
|
|
3
3
|
<% module_namespacing do -%>
|
4
4
|
class <%= controller_class_name %>ControllerTest < ActionController::TestCase
|
5
5
|
|
6
|
-
|
7
|
-
@<%= singular_table_name %>
|
6
|
+
def <%= singular_table_name %>
|
7
|
+
@<%= singular_table_name %> ||= <%= table_name %> :one
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_index
|
@@ -27,23 +27,23 @@ class <%= controller_class_name %>ControllerTest < ActionController::TestCase
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def test_show
|
30
|
-
get :show, <%= key_value :id,
|
30
|
+
get :show, <%= key_value :id, singular_table_name %>
|
31
31
|
assert_response :success
|
32
32
|
end
|
33
33
|
|
34
34
|
def test_edit
|
35
|
-
get :edit, <%= key_value :id,
|
35
|
+
get :edit, <%= key_value :id, singular_table_name %>
|
36
36
|
assert_response :success
|
37
37
|
end
|
38
38
|
|
39
39
|
def test_update
|
40
|
-
put :update, <%= key_value :id,
|
40
|
+
put :update, <%= key_value :id, singular_table_name %>, <%= "#{singular_table_name}: { #{attributes_hash} }" %>
|
41
41
|
assert_redirected_to <%= singular_table_name %>_path(assigns(:<%= singular_table_name %>))
|
42
42
|
end
|
43
43
|
|
44
44
|
def test_destroy
|
45
45
|
assert_difference('<%= class_name %>.count', -1) do
|
46
|
-
delete :destroy, <%= key_value :id,
|
46
|
+
delete :destroy, <%= key_value :id, singular_table_name %>
|
47
47
|
end
|
48
48
|
|
49
49
|
assert_redirected_to <%= index_helper %>_path
|