Class Expectations::Suite
In: lib/expectations/suite.rb
Parent: Object

Methods

Included Modules

Mocha::API

Attributes

silent  [RW] 

Public Class methods

[Source]

    # File lib/expectations/suite.rb, line 8
 8:   def initialize
 9:     @do_not_run = false
10:   end

Public Instance methods

[Source]

    # File lib/expectations/suite.rb, line 32
32:   def do_not_run
33:     @do_not_run = true
34:   end

[Source]

    # File lib/expectations/suite.rb, line 16
16:   def execute(out=STDOUT, suite_result = Expectations::SuiteResults.new(out))
17:     return suite_result if @do_not_run
18:     benchmark = Benchmark.measure do
19:       expectations_for(ENV["LINE"]).each { |expectation| suite_result << expectation.execute }
20:     end
21:     suite_result.print_results(benchmark)
22:     suite_result.write_junit_xml(ENV["JUnitXmlPath"]) unless ENV["JUnitXmlPath"].nil?
23:     suite_result
24:   end

[Source]

    # File lib/expectations/suite.rb, line 26
26:   def expect(expected, &block)
27:     file, line = *caller.first.match(/\A(.+):(\d+)/)[1..2]
28:     expectations << Expectations::Expectation.new(expected, file, line, &block)
29:     expectations.last.expected
30:   end

[Source]

    # File lib/expectations/suite.rb, line 41
41:   def expectations
42:     @expectations ||= []
43:   end

[Source]

    # File lib/expectations/suite.rb, line 36
36:   def expectations_for(line)
37:     return expectations if line.nil?
38:     [expectations.inject { |result, expectation| expectation.line > line.to_i ? result : expectation }]
39:   end

[Source]

    # File lib/expectations/suite.rb, line 12
12:   def xml(string)
13:     Expectations::XmlString.new(string)
14:   end

[Validate]