Class: RSpec::Unit::TestCase

Inherits:
Core::ExampleGroup show all
Defined in:
lib/rspec/unit/test_case.rb

Defined Under Namespace

Classes: ExamplesCollection

Constant Summary

TEST_METHOD_PATTERN =
/^test_/

Constants included from Assertions

Assertions::UncaughtThrow

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Assertions

#assert, #assert_block, #assert_equal, #assert_in_delta, #assert_instance_of, #assert_kind_of, #assert_match, #assert_nil, #assert_no_match, #assert_not_equal, #assert_not_nil, #assert_not_same, #assert_nothing_raised, #assert_nothing_thrown, #assert_operator, #assert_raise, #assert_raises, #assert_respond_to, #assert_same, #assert_send, #assert_throws, #build_message, #flunk, use_pp=

Constructor Details

#initializeTestCase



121
122
123
124
# File 'lib/rspec/unit/test_case.rb', line 121

def initialize
  @test_passed = true
  super
end

Class Method Details

.ancestorsObject



53
54
55
# File 'lib/rspec/unit/test_case.rb', line 53

def self.ancestors
  super[0..-2]
end

.examplesObject



49
50
51
# File 'lib/rspec/unit/test_case.rb', line 49

def self.examples
  @tc_examples ||= ExamplesCollection.new(self, super)
end

.inherited(klass) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/rspec/unit/test_case.rb', line 21

def self.inherited(klass)
  super
  
  install_setup_and_teardown(klass)
            
  klass.set_it_up(test_case_name(klass), {:caller => caller})
  klass.[:example_group][:test_unit] = true
  children << klass
  world.example_groups << klass
end

.method_added(id) ⇒ Object



40
41
42
43
44
45
46
47
# File 'lib/rspec/unit/test_case.rb', line 40

def self.method_added(id)
  name = id.to_s
  if test_method?(name)
    caller_lines[name] = caller
    [name] = @_metadata_for_next
    @_metadata_for_next = nil
  end
end

.test_case_info(options) ⇒ Object



32
33
34
# File 'lib/rspec/unit/test_case.rb', line 32

def self.test_case_info(options)
  [:example_group].update(options)
end

.test_info(options) ⇒ Object



36
37
38
# File 'lib/rspec/unit/test_case.rb', line 36

def self.test_info(options)
  @_metadata_for_next = options
end

Instance Method Details

#execute(method) ⇒ Object



132
133
134
135
136
137
138
139
# File 'lib/rspec/unit/test_case.rb', line 132

def execute(method)
  begin
    send(method.to_sym)
  rescue
    @test_passed = false
    raise
  end
end

#setupObject



126
127
# File 'lib/rspec/unit/test_case.rb', line 126

def setup
end

#teardownObject



129
130
# File 'lib/rspec/unit/test_case.rb', line 129

def teardown
end