Don't raise on mass assignment for test
This commit is contained in:
parent
215193d19a
commit
2a24bcc6cf
1
Gemfile
1
Gemfile
|
@ -8,6 +8,7 @@ else
|
||||||
gem "arel", '~> 2.1.3'
|
gem "arel", '~> 2.1.3'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
gem "jquery-rails"
|
||||||
gem "coffee-script"
|
gem "coffee-script"
|
||||||
gem "sass"
|
gem "sass"
|
||||||
|
|
||||||
|
|
|
@ -34,11 +34,6 @@
|
||||||
# like if you have constraints or database-specific column types
|
# like if you have constraints or database-specific column types
|
||||||
# config.active_record.schema_format = :sql
|
# config.active_record.schema_format = :sql
|
||||||
|
|
||||||
<%- unless options.skip_active_record? -%>
|
|
||||||
# Raise exception on mass assignment protection for ActiveRecord models
|
|
||||||
config.active_record.mass_assignment_sanitizer = :strict
|
|
||||||
<%- end -%>
|
|
||||||
|
|
||||||
# Print deprecation notices to the stderr
|
# Print deprecation notices to the stderr
|
||||||
config.active_support.deprecation = :stderr
|
config.active_support.deprecation = :stderr
|
||||||
end
|
end
|
||||||
|
|
|
@ -61,22 +61,22 @@ module ApplicationTests
|
||||||
|
|
||||||
def test_rake_test_error_output
|
def test_rake_test_error_output
|
||||||
Dir.chdir(app_path){ `rake db:migrate` }
|
Dir.chdir(app_path){ `rake db:migrate` }
|
||||||
|
|
||||||
app_file "config/database.yml", <<-RUBY
|
app_file "config/database.yml", <<-RUBY
|
||||||
development:
|
development:
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
app_file "test/unit/one_unit_test.rb", <<-RUBY
|
app_file "test/unit/one_unit_test.rb", <<-RUBY
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
app_file "test/functional/one_functional_test.rb", <<-RUBY
|
app_file "test/functional/one_functional_test.rb", <<-RUBY
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
app_file "test/integration/one_integration_test.rb", <<-RUBY
|
app_file "test/integration/one_integration_test.rb", <<-RUBY
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
silence_stderr do
|
silence_stderr do
|
||||||
output = Dir.chdir(app_path){ `rake test` }
|
output = Dir.chdir(app_path){ `rake test` }
|
||||||
assert_match /Errors running test:units! #<ActiveRecord::AdapterNotSpecified/, output
|
assert_match /Errors running test:units! #<ActiveRecord::AdapterNotSpecified/, output
|
||||||
|
@ -151,5 +151,14 @@ module ApplicationTests
|
||||||
assert_equal 2, ::AppTemplate::Application::Product.count
|
assert_equal 2, ::AppTemplate::Application::Product.count
|
||||||
assert_equal 0, ::AppTemplate::Application::User.count
|
assert_equal 0, ::AppTemplate::Application::User.count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_scaffold_tests_pass_by_default
|
||||||
|
content = Dir.chdir(app_path) do
|
||||||
|
`rails generate scaffold user username:string password:string`
|
||||||
|
`bundle exec rake db:migrate db:test:clone test`
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_match(/7 tests, 10 assertions, 0 failures, 0 errors/, content)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Reference in New Issue