Class: RSpec::Unit::TestCase::ExamplesCollection

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/rspec/unit/test_case.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(testcase, core_examples) ⇒ ExamplesCollection

Returns a new instance of ExamplesCollection



152
153
154
# File 'lib/rspec/unit/test_case.rb', line 152

def initialize(testcase, core_examples)
  @testcase, @core_examples = testcase, core_examples
end

Instance Attribute Details

#core_examplesObject

Returns the value of attribute core_examples



150
151
152
# File 'lib/rspec/unit/test_case.rb', line 150

def core_examples
  @core_examples
end

#testcaseObject

Returns the value of attribute testcase



150
151
152
# File 'lib/rspec/unit/test_case.rb', line 150

def testcase
  @testcase
end

Instance Method Details

#<<(example) ⇒ Object



176
177
178
# File 'lib/rspec/unit/test_case.rb', line 176

def <<(example)
  core_examples << example
end

#eachObject



180
181
182
183
# File 'lib/rspec/unit/test_case.rb', line 180

def each
  core_examples.each{|ex| yield(ex)}
  tests.each{|test| yield(test)}
end

#empty?Boolean

Returns:

  • (Boolean)


168
169
170
# File 'lib/rspec/unit/test_case.rb', line 168

def empty?
  core_examples.empty? && number_of_tests == 0
end

#lastObject



172
173
174
# File 'lib/rspec/unit/test_case.rb', line 172

def last
  tests.last || core_examples.last
end

#number_of_testsObject



160
161
162
# File 'lib/rspec/unit/test_case.rb', line 160

def number_of_tests
  testcase.send(:number_of_tests)
end

#sizeObject



164
165
166
# File 'lib/rspec/unit/test_case.rb', line 164

def size
  core_examples.size + number_of_tests
end

#testsObject



156
157
158
# File 'lib/rspec/unit/test_case.rb', line 156

def tests
  testcase.send(:tests)
end

#to_aryObject



185
186
187
# File 'lib/rspec/unit/test_case.rb', line 185

def to_ary
  core_examples + tests
end

#uniqObject



189
190
191
# File 'lib/rspec/unit/test_case.rb', line 189

def uniq
  to_ary.uniq
end