Class: GenSpec::Matchers::ResultMatcher
- Defined in:
- lib/genspec/matchers/result_matcher.rb
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
Attributes inherited from Base
#args, #block, #destination_root, #error, #generator, #init_blocks
Instance Method Summary collapse
- #failure_message ⇒ Object
- #generated ⇒ Object
-
#initialize(filename, &block) ⇒ ResultMatcher
constructor
A new instance of ResultMatcher.
- #negative_failure_message ⇒ Object
Methods inherited from Base
#match!, #matched?, #matches?, #source_root
Constructor Details
#initialize(filename, &block) ⇒ ResultMatcher
Returns a new instance of ResultMatcher.
6 7 8 9 |
# File 'lib/genspec/matchers/result_matcher.rb', line 6 def initialize(filename, &block) @filename = filename super(&block) end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
4 5 6 |
# File 'lib/genspec/matchers/result_matcher.rb', line 4 def filename @filename end |
Instance Method Details
#failure_message ⇒ Object
29 30 31 |
# File 'lib/genspec/matchers/result_matcher.rb', line 29 def "Expected to generate #{filename}" end |
#generated ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/genspec/matchers/result_matcher.rb', line 11 def generated if filename path = File.join(destination_root, filename) if File.exist?(path) match! spec_file_contents(path) end else # there was no error, so in the context of # "should generate", it most certainly # generated. match! if block block.call end end end |
#negative_failure_message ⇒ Object
33 34 35 |
# File 'lib/genspec/matchers/result_matcher.rb', line 33 def "Expected to not generate #{filename}" end |