Sha256: c9c9b819b5d067154b3c0179526a0b47f4b2ce5769b6d8ddd8f59cd87c1a71cc

Contents?: true

Size: 880 Bytes

Versions: 4

Compression:

Stored size: 880 Bytes

Contents

# This method tries to see if a specific method is contained in the generated file.
# It can operate (should) on either a file name or the raw content 
#
#   generated_file_name.should have_method "hello" # 'my/path/say_hello.rb'.should have_method "hello"
#
#   say_hello_file_content.should have_method "hello"
#
module RSpec::RubyContentMatchers
  class HaveClassSelf < RSpec::RubyContentMatcher

    def initialize
      @end_option = 'class'
    end
  
    def failure_message
      super
      display "Expected there to be a: class << self"
    end 
    
    def negative_failure_message
      super
      display "Did not expect there to be a: class << self"
    end

    protected
    
    def main_expr
      'class\s*<<\s*self' + ANY_GROUP
    end

    def alt_end
      'class self'
    end             
  end

  def have_class_self
    HaveClassSelf.new
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
code-spec-0.4.0 lib/code_spec/matchers/have_class_self.rb
code-spec-0.3.0 lib/code_spec/matchers/have_class_self.rb
code-spec-0.2.11 lib/code_spec/matchers/have_class_self.rb
code-spec-0.2.9 lib/code_spec/matchers/have_class_self.rb