Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

call directly to ActionController::TestCase.tests()

  • Loading branch information...
commit 5e2f9aa9a2c5c0c2a9ddf47d8e5ef9196f10e78f 1 parent 18065b9
David Chelimsky authored
1  lib/spec/rails/example/controller_example_group.rb
View
@@ -74,6 +74,7 @@ def inherited(klass) # :nodoc:
# ...
def controller_name(name)
@controller_class_name = "#{name}_controller".camelize
+ tests @controller_class_name.constantize
end
attr_accessor :controller_class_name # :nodoc:
end
9 lib/spec/rails/example/functional_example_group.rb
View
@@ -4,9 +4,18 @@ module Spec
module Rails
module Example
class FunctionalExampleGroup < ActionController::TestCase
+ def self.inherited(klass) # :nodoc:
+ tests described_type if described_type
+ super
+ end
+
def setup_controller_request_and_response
# no-op to override AC::TC's setup w/ conflicts with the before(:each) below
end
+
+ def setup
+ # no-op to override AC::TC's setup w/ conflicts with the before(:each) below
+ end
attr_reader :request, :response
before(:each) do
9 lib/spec/rails/example/helper_example_group.rb
View
@@ -1,6 +1,10 @@
module Spec
module Rails
module Example
+ class HelperExampleGroupController < ApplicationController #:nodoc:
+ attr_accessor :request, :url
+ end
+
# Helper Specs live in $RAILS_ROOT/spec/helpers/.
#
# Helper Specs use Spec::Rails::Example::HelperExampleGroup, which allows you to
@@ -26,6 +30,7 @@ module Example
# end
# end
class HelperExampleGroup < FunctionalExampleGroup
+ tests HelperExampleGroupController
attr_accessor :output_buffer
class HelperObject < ActionView::Base
@@ -162,10 +167,6 @@ def _assigns_hash_proxy
end
end
-
- class HelperExampleGroupController < ApplicationController #:nodoc:
- attr_accessor :request, :url
- end
end
end
end
46 lib/spec/rails/example/view_example_group.rb
View
@@ -1,6 +1,29 @@
module Spec
module Rails
module Example
+ class ViewExampleGroupController < ApplicationController #:nodoc:
+ include Spec::Rails::Example::RenderObserver
+ attr_reader :template
+
+ def add_helper_for(template_path)
+ add_helper(template_path.split('/')[0])
+ end
+
+ def add_helper(name)
+ begin
+ helper_module = "#{name}_helper".camelize.constantize
+ rescue
+ return
+ end
+ (class << template; self; end).class_eval do
+ include helper_module
+ end
+ end
+
+ def forget_variables_added_to_assigns
+ end
+ end
+
# View Examples live in $RAILS_ROOT/spec/views/.
#
# View Specs use Spec::Rails::Example::ViewExampleGroup,
@@ -24,6 +47,7 @@ module Example
# end
# end
class ViewExampleGroup < FunctionalExampleGroup
+ tests ViewExampleGroupController
before(:each) do
ensure_that_flash_and_session_work_properly
end
@@ -155,28 +179,6 @@ def _assigns_hash_proxy
end
end
- class ViewExampleGroupController < ApplicationController #:nodoc:
- include Spec::Rails::Example::RenderObserver
- attr_reader :template
-
- def add_helper_for(template_path)
- add_helper(template_path.split('/')[0])
- end
-
- def add_helper(name)
- begin
- helper_module = "#{name}_helper".camelize.constantize
- rescue
- return
- end
- (class << template; self; end).class_eval do
- include helper_module
- end
- end
-
- def forget_variables_added_to_assigns
- end
- end
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.