Class: RSpec::Unit::TestCase::ExamplesCollection
- Inherits:
-
Object
- Object
- RSpec::Unit::TestCase::ExamplesCollection
- Includes:
- Enumerable
- Defined in:
- lib/rspec/unit/test_case.rb
Instance Attribute Summary collapse
-
#core_examples ⇒ Object
Returns the value of attribute core_examples.
-
#testcase ⇒ Object
Returns the value of attribute testcase.
Instance Method Summary collapse
- #<<(example) ⇒ Object
- #each ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(testcase, core_examples) ⇒ ExamplesCollection
constructor
A new instance of ExamplesCollection.
- #last ⇒ Object
- #number_of_tests ⇒ Object
- #size ⇒ Object
- #tests ⇒ Object
- #to_ary ⇒ Object
- #uniq ⇒ Object
Constructor Details
#initialize(testcase, core_examples) ⇒ ExamplesCollection
Returns a new instance of ExamplesCollection.
141 142 143 |
# File 'lib/rspec/unit/test_case.rb', line 141 def initialize(testcase, core_examples) @testcase, @core_examples = testcase, core_examples end |
Instance Attribute Details
#core_examples ⇒ Object
Returns the value of attribute core_examples.
139 140 141 |
# File 'lib/rspec/unit/test_case.rb', line 139 def core_examples @core_examples end |
#testcase ⇒ Object
Returns the value of attribute testcase.
139 140 141 |
# File 'lib/rspec/unit/test_case.rb', line 139 def testcase @testcase end |
Instance Method Details
#<<(example) ⇒ Object
165 166 167 |
# File 'lib/rspec/unit/test_case.rb', line 165 def <<(example) core_examples << example end |
#each ⇒ Object
169 170 171 172 |
# File 'lib/rspec/unit/test_case.rb', line 169 def each core_examples.each{|ex| yield(ex)} tests.each{|test| yield(test)} end |
#empty? ⇒ Boolean
157 158 159 |
# File 'lib/rspec/unit/test_case.rb', line 157 def empty? core_examples.empty? && number_of_tests == 0 end |
#last ⇒ Object
161 162 163 |
# File 'lib/rspec/unit/test_case.rb', line 161 def last tests.last || core_examples.last end |
#number_of_tests ⇒ Object
149 150 151 |
# File 'lib/rspec/unit/test_case.rb', line 149 def number_of_tests testcase.send(:number_of_tests) end |
#size ⇒ Object
153 154 155 |
# File 'lib/rspec/unit/test_case.rb', line 153 def size core_examples.size + number_of_tests end |
#tests ⇒ Object
145 146 147 |
# File 'lib/rspec/unit/test_case.rb', line 145 def tests testcase.send(:tests) end |
#to_ary ⇒ Object
174 175 176 |
# File 'lib/rspec/unit/test_case.rb', line 174 def to_ary core_examples + tests end |
#uniq ⇒ Object
178 179 180 |
# File 'lib/rspec/unit/test_case.rb', line 178 def uniq to_ary.uniq end |