Class: XSpec::SpecFile
- Inherits:
-
Object
- Object
- XSpec::SpecFile
- Defined in:
- lib/xspec.rb
Instance Attribute Summary collapse
-
#compiled_xspec ⇒ Object
readonly
Returns the value of attribute compiled_xspec.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#failures ⇒ Object
readonly
Returns the value of attribute failures.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#processor ⇒ Object
readonly
Returns the value of attribute processor.
Instance Method Summary collapse
- #errored? ⇒ Boolean
- #failures? ⇒ Boolean
-
#initialize(processor, path, compiled_xspec) ⇒ SpecFile
constructor
A new instance of SpecFile.
- #not_run? ⇒ Boolean
- #ran? ⇒ Boolean
- #run! ⇒ Object
- #successful? ⇒ Boolean
Constructor Details
#initialize(processor, path, compiled_xspec) ⇒ SpecFile
Returns a new instance of SpecFile.
127 128 129 130 131 132 133 |
# File 'lib/xspec.rb', line 127 def initialize(processor, path, compiled_xspec) @processor, @path, @compiled_xspec = processor, path, compiled_xspec @ran = false @errored = false @failures = [] @error = '' end |
Instance Attribute Details
#compiled_xspec ⇒ Object (readonly)
Returns the value of attribute compiled_xspec.
125 126 127 |
# File 'lib/xspec.rb', line 125 def compiled_xspec @compiled_xspec end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
125 126 127 |
# File 'lib/xspec.rb', line 125 def error @error end |
#failures ⇒ Object (readonly)
Returns the value of attribute failures.
125 126 127 |
# File 'lib/xspec.rb', line 125 def failures @failures end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
125 126 127 |
# File 'lib/xspec.rb', line 125 def path @path end |
#processor ⇒ Object (readonly)
Returns the value of attribute processor.
125 126 127 |
# File 'lib/xspec.rb', line 125 def processor @processor end |
Instance Method Details
#errored? ⇒ Boolean
147 148 149 |
# File 'lib/xspec.rb', line 147 def errored? @errored end |
#failures? ⇒ Boolean
143 144 145 |
# File 'lib/xspec.rb', line 143 def failures? !@failures.empty? end |
#not_run? ⇒ Boolean
135 136 137 |
# File 'lib/xspec.rb', line 135 def not_run? !@ran end |
#ran? ⇒ Boolean
139 140 141 |
# File 'lib/xspec.rb', line 139 def ran? @ran end |
#run! ⇒ Object
155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/xspec.rb', line 155 def run! if not_run? begin @ran = true output = compiled_xspec.transform_with_named_template(Saxon::S9API::QName.fromClarkName('{http://www.jenitennison.com/xslt/xspec}main')) check_failures(output).each do |failure| @failures << test_label(failure) end rescue Exception => e @errored = true @error = e.to_s end end end |
#successful? ⇒ Boolean
151 152 153 |
# File 'lib/xspec.rb', line 151 def successful? !(failures? || errored?) end |