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.
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_examples ⇒ Object
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 |
#testcase ⇒ Object
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 |
#each ⇒ Object
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
168 169 170 |
# File 'lib/rspec/unit/test_case.rb', line 168 def empty? core_examples.empty? && number_of_tests == 0 end |
#last ⇒ Object
172 173 174 |
# File 'lib/rspec/unit/test_case.rb', line 172 def last tests.last || core_examples.last end |
#number_of_tests ⇒ Object
160 161 162 |
# File 'lib/rspec/unit/test_case.rb', line 160 def number_of_tests testcase.send(:number_of_tests) end |
#size ⇒ Object
164 165 166 |
# File 'lib/rspec/unit/test_case.rb', line 164 def size core_examples.size + number_of_tests end |
#tests ⇒ Object
156 157 158 |
# File 'lib/rspec/unit/test_case.rb', line 156 def tests testcase.send(:tests) end |
#to_ary ⇒ Object
185 186 187 |
# File 'lib/rspec/unit/test_case.rb', line 185 def to_ary core_examples + tests end |
#uniq ⇒ Object
189 190 191 |
# File 'lib/rspec/unit/test_case.rb', line 189 def uniq to_ary.uniq end |