diff options
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/spec_style_test.rb | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/actionpack/test/controller/spec_style_test.rb b/actionpack/test/controller/spec_style_test.rb new file mode 100644 index 0000000000..96c08ac3b1 --- /dev/null +++ b/actionpack/test/controller/spec_style_test.rb @@ -0,0 +1,116 @@ +require "abstract_unit" + +class ApplicationController < ActionController::Base; end +class ModelsController < ApplicationController; end +module Admin + class WidgetsController < ApplicationController; end +end + +# ApplicationController +describe ApplicationController do + describe "nested" do + describe "even deeper" do + it "exists" do + assert_kind_of ApplicationController, @controller + end + end + end +end + +describe ApplicationController, :index do + describe "nested" do + describe "even deeper" do + it "exists" do + assert_kind_of ApplicationController, @controller + end + end + end +end + +describe ApplicationController, "unauthenticated user" do + describe "nested" do + describe "even deeper" do + it "exists" do + assert_kind_of ApplicationController, @controller + end + end + end +end + +# ModelsController +describe ModelsController do + describe "nested" do + describe "even deeper" do + it "exists" do + assert_kind_of ModelsController, @controller + end + end + end +end + +describe ModelsController, :index do + describe "nested" do + describe "even deeper" do + it "exists" do + assert_kind_of ModelsController, @controller + end + end + end +end + +describe ModelsController, "unauthenticated user" do + describe "nested" do + describe "even deeper" do + it "exists" do + assert_kind_of ModelsController, @controller + end + end + end +end + +# Nested Admin::WidgetsControllerTest +module Admin + class WidgetsControllerTest < ActionController::TestCase + test "exists" do + assert_kind_of Admin::WidgetsController, @controller + end + end + + describe WidgetsController do + describe "index" do + it "respond successful" do + assert_kind_of Admin::WidgetsController, @controller + end + end + end + + describe WidgetsController, "unauthenticated users" do + describe "index" do + it "respond successful" do + assert_kind_of Admin::WidgetsController, @controller + end + end + end +end + +class Admin::WidgetsControllerTest < ActionController::TestCase + test "exists here too" do + assert_kind_of Admin::WidgetsController, @controller + end +end + +describe Admin::WidgetsController do + describe "index" do + it "respond successful" do + assert_kind_of Admin::WidgetsController, @controller + end + end +end + +describe Admin::WidgetsController, "unauthenticated users" do + describe "index" do + it "respond successful" do + assert_kind_of Admin::WidgetsController, @controller + end + end +end |