aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/application/configuration_test.rb16
-rw-r--r--railties/test/application/middleware_stack_defaults_test.rb2
-rw-r--r--railties/test/application/paths_test.rb1
-rw-r--r--railties/test/application/url_generation_test.rb2
-rw-r--r--railties/test/generators/app_generator_test.rb7
-rw-r--r--railties/test/generators/scaffold_controller_generator_test.rb1
-rw-r--r--railties/test/generators/scaffold_generator_test.rb8
-rw-r--r--railties/test/generators/stylesheets_generator_test.rb17
-rw-r--r--railties/test/isolation/abstract_unit.rb2
9 files changed, 27 insertions, 29 deletions
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb
index 68ca2acaad..90f2e2b370 100644
--- a/railties/test/application/configuration_test.rb
+++ b/railties/test/application/configuration_test.rb
@@ -234,6 +234,22 @@ module ApplicationTests
assert_equal File.expand_path(__FILE__), last_response.headers["X-Lighttpd-Send-File"]
end
+ test "config.secret_token is sent in env" do
+ make_basic_app do |app|
+ app.config.secret_token = 'ThisIsASECRET123'
+ end
+
+ class ::OmgController < ActionController::Base
+ def index
+ cookies.signed[:some_key] = "some_value"
+ render :text => env["action_dispatch.secret_token"]
+ end
+ end
+
+ get "/"
+ assert_equal 'ThisIsASECRET123', last_response.body
+ end
+
test "protect from forgery is the default in a new app" do
make_basic_app
diff --git a/railties/test/application/middleware_stack_defaults_test.rb b/railties/test/application/middleware_stack_defaults_test.rb
index 284f7e2e5b..f31ca01fbf 100644
--- a/railties/test/application/middleware_stack_defaults_test.rb
+++ b/railties/test/application/middleware_stack_defaults_test.rb
@@ -10,7 +10,7 @@ class MiddlewareStackDefaultsTest < Test::Unit::TestCase
Object.const_set(:MyApplication, Class.new(Rails::Application))
MyApplication.class_eval do
- config.cookie_secret = "3b7cd727ee24e8444053437c36cc66c4"
+ config.secret_token = "3b7cd727ee24e8444053437c36cc66c4"
config.session_store :cookie_store, :key => "_myapp_session"
end
end
diff --git a/railties/test/application/paths_test.rb b/railties/test/application/paths_test.rb
index 589e515d05..5ab558c026 100644
--- a/railties/test/application/paths_test.rb
+++ b/railties/test/application/paths_test.rb
@@ -71,6 +71,7 @@ module ApplicationTests
assert_in_load_path "lib"
assert_in_load_path "vendor"
+ assert_not_in_load_path "app", "views"
assert_not_in_load_path "app", "metal"
assert_not_in_load_path "config"
assert_not_in_load_path "config", "locales"
diff --git a/railties/test/application/url_generation_test.rb b/railties/test/application/url_generation_test.rb
index 04f5454e09..72cae23985 100644
--- a/railties/test/application/url_generation_test.rb
+++ b/railties/test/application/url_generation_test.rb
@@ -14,7 +14,7 @@ module ApplicationTests
require "action_controller/railtie"
class MyApp < Rails::Application
- config.cookie_secret = "3b7cd727ee24e8444053437c36cc66c4"
+ config.secret_token = "3b7cd727ee24e8444053437c36cc66c4"
config.session_store :cookie_store, :key => "_myapp_session"
end
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index 95ca2acf2c..64579c1205 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -51,6 +51,13 @@ class AppGeneratorTest < Rails::Generators::TestCase
).each{ |path| assert_file path }
end
+ def test_application_controller_and_layout_files
+ run_generator
+ assert_file "app/controllers/application_controller.rb", /layout 'application'/
+ assert_file "app/views/layouts/application.html.erb", /stylesheet_link_tag 'application'/
+ assert_file "public/stylesheets/application.css"
+ end
+
def test_name_collision_raises_an_error
content = capture(:stderr){ run_generator [File.join(destination_root, "generate")] }
assert_equal "Invalid application name generate. Please give a name which does not match one of the reserved rails words.\n", content
diff --git a/railties/test/generators/scaffold_controller_generator_test.rb b/railties/test/generators/scaffold_controller_generator_test.rb
index 77ed63b1bb..f5af137ced 100644
--- a/railties/test/generators/scaffold_controller_generator_test.rb
+++ b/railties/test/generators/scaffold_controller_generator_test.rb
@@ -66,7 +66,6 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
new
show
).each { |view| assert_file "app/views/users/#{view}.html.erb" }
- assert_file "app/views/layouts/users.html.erb"
end
def test_functional_tests
diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb
index 6cf2efca45..3cad65f503 100644
--- a/railties/test/generators/scaffold_generator_test.rb
+++ b/railties/test/generators/scaffold_generator_test.rb
@@ -70,14 +70,10 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
show
_form
).each { |view| assert_file "app/views/product_lines/#{view}.html.erb" }
- assert_file "app/views/layouts/product_lines.html.erb"
# Helpers
assert_file "app/helpers/product_lines_helper.rb"
assert_file "test/unit/helpers/product_lines_helper_test.rb"
-
- # Stylesheets
- assert_file "public/stylesheets/scaffold.css"
end
def test_scaffold_on_revoke
@@ -101,13 +97,9 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
# Views
assert_no_file "app/views/product_lines"
- assert_no_file "app/views/layouts/product_lines.html.erb"
# Helpers
assert_no_file "app/helpers/product_lines_helper.rb"
assert_no_file "test/unit/helpers/product_lines_helper_test.rb"
-
- # Stylesheets (should not be removed)
- assert_file "public/stylesheets/scaffold.css"
end
end
diff --git a/railties/test/generators/stylesheets_generator_test.rb b/railties/test/generators/stylesheets_generator_test.rb
deleted file mode 100644
index aaeb686daa..0000000000
--- a/railties/test/generators/stylesheets_generator_test.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-require 'generators/generators_test_helper'
-require 'rails/generators/rails/stylesheets/stylesheets_generator'
-
-class StylesheetsGeneratorTest < Rails::Generators::TestCase
- include GeneratorsTestHelper
-
- def test_copy_stylesheets
- run_generator
- assert_file "public/stylesheets/scaffold.css"
- end
-
- def test_stylesheets_are_not_deleted_on_revoke
- run_generator
- run_generator [], :behavior => :revoke
- assert_file "public/stylesheets/scaffold.css"
- end
-end
diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb
index 8f2f15b49e..e6896a1629 100644
--- a/railties/test/isolation/abstract_unit.rb
+++ b/railties/test/isolation/abstract_unit.rb
@@ -100,7 +100,7 @@ module TestHelpers
end
end
- add_to_config 'config.cookie_secret = "3b7cd727ee24e8444053437c36cc66c4"; config.session_store :cookie_store, :key => "_myapp_session"'
+ add_to_config 'config.secret_token = "3b7cd727ee24e8444053437c36cc66c4"; config.session_store :cookie_store, :key => "_myapp_session"'
end
class Bukkit