Module: Test::Spec::Rails
- Defined in:
- lib/test/spec/rails.rb,
lib/test/spec/rails/macros.rb,
lib/test/spec/rails/expectations.rb,
lib/test/spec/rails/spec_responder.rb,
lib/test/spec/rails/macros/response.rb,
lib/test/spec/rails/request_helpers.rb,
lib/test/spec/rails/response_helpers.rb,
lib/test/spec/rails/controller_helpers.rb,
lib/test/spec/rails/macros/authorization.rb
Defined Under Namespace
Modules: ControllerHelpers, Helpers, Macros, RequestHelpers, ResponseHelpers, ShouldExpectations, ShouldNotExpectations
Classes: Layout, SpecResponder, Status, Template
Class Method Summary
collapse
Class Method Details
20
21
22
23
24
25
26
27
28
|
# File 'lib/test/spec/rails.rb', line 20
def self.(args)
class_to_test = args.find { |a| a.is_a?(Module) }
superclass = test_case_for_class(class_to_test)
args.delete(class_to_test) if superclass == class_to_test
name = args.map { |a| a.to_s }.join(' ')
[name, class_to_test, superclass]
end
|
.test_case_for_class(klass) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/test/spec/rails.rb', line 30
def self.test_case_for_class(klass)
if klass
if klass.ancestors.include?(ActiveRecord::Base)
ActiveRecord::TestCase
elsif klass.ancestors.include?(ActionController::Base)
ActionController::TestCase
elsif klass.ancestors.include?(ActiveSupport::TestCase)
klass
elsif !klass.is_a?(Class) && klass.to_s.ends_with?('Helper')
ActionView::TestCase
end
end || ActiveSupport::TestCase
end
|