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.
156 157 158 159 160 161 162 |
# File 'lib/xspec.rb', line 156 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.
154 155 156 |
# File 'lib/xspec.rb', line 154 def compiled_xspec @compiled_xspec end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
154 155 156 |
# File 'lib/xspec.rb', line 154 def error @error end |
#failures ⇒ Object (readonly)
Returns the value of attribute failures.
154 155 156 |
# File 'lib/xspec.rb', line 154 def failures @failures end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
154 155 156 |
# File 'lib/xspec.rb', line 154 def path @path end |
#processor ⇒ Object (readonly)
Returns the value of attribute processor.
154 155 156 |
# File 'lib/xspec.rb', line 154 def processor @processor end |
Instance Method Details
#errored? ⇒ Boolean
176 177 178 |
# File 'lib/xspec.rb', line 176 def errored? @errored end |
#failures? ⇒ Boolean
172 173 174 |
# File 'lib/xspec.rb', line 172 def failures? !@failures.empty? end |
#not_run? ⇒ Boolean
164 165 166 |
# File 'lib/xspec.rb', line 164 def not_run? !@ran end |
#ran? ⇒ Boolean
168 169 170 |
# File 'lib/xspec.rb', line 168 def ran? @ran end |
#run! ⇒ Object
184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
# File 'lib/xspec.rb', line 184 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
180 181 182 |
# File 'lib/xspec.rb', line 180 def successful? !(failures? || errored?) end |