Class: RBeautifyMatchers::BeBlockEndLike
- Defined in:
- lib/ruby-beautify/spec/spec_helper.rb
Overview
:nodoc:
Instance Method Summary collapse
- #description ⇒ Object
- #expected_string ⇒ Object
- #failure_message ⇒ Object
- #got_string ⇒ Object
-
#initialize(block_start, offset, match, after_match) ⇒ BeBlockEndLike
constructor
A new instance of BeBlockEndLike.
- #matches?(target_block) ⇒ Boolean
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(block_start, offset, match, after_match) ⇒ BeBlockEndLike
Returns a new instance of BeBlockEndLike.
49 50 51 52 53 54 55 |
# File 'lib/ruby-beautify/spec/spec_helper.rb', line 49 def initialize(block_start, offset, match, after_match) # triggers the standard Spec::Matchers::Be magic, as if the original Spec::Matchers#method_missing had fired @block_start = block_start @offset = offset @match = match @after_match = after_match end |
Instance Method Details
#description ⇒ Object
82 83 84 |
# File 'lib/ruby-beautify/spec/spec_helper.rb', line 82 def description "block end with" end |
#expected_string ⇒ Object
70 71 72 |
# File 'lib/ruby-beautify/spec/spec_helper.rb', line 70 def expected_string "block_end: #{@block_start.name}, offset: #{@offset}, match: '#{@match}', after_match: '#{@after_match}'" end |
#failure_message ⇒ Object
62 63 64 |
# File 'lib/ruby-beautify/spec/spec_helper.rb', line 62 def "expected\n#{expected_string} but got\n#{got_string}" end |
#got_string ⇒ Object
74 75 76 77 78 79 80 |
# File 'lib/ruby-beautify/spec/spec_helper.rb', line 74 def got_string if @target_block.nil? 'nil' else "block_end: #{@target_block.block_start.name}, offset: #{@target_block.offset}, match: '#{@target_block.match}', after_match: '#{@target_block.after_match}'" end end |
#matches?(target_block) ⇒ Boolean
57 58 59 60 |
# File 'lib/ruby-beautify/spec/spec_helper.rb', line 57 def matches?(target_block) @target_block = target_block expected_string == got_string end |
#negative_failure_message ⇒ Object
66 67 68 |
# File 'lib/ruby-beautify/spec/spec_helper.rb', line 66 def "expected to be different from #{expected_string}" end |