Sha256: d3fbc5e8ae75d0b30040ae17812a691c01f93b121ef1a64834610a37d55625e6

Contents?: true

Size: 871 Bytes

Versions: 15

Compression:

Stored size: 871 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
      return "Expected there to be a: class << self"
    end 
    
    def negative_failure_message
      super
      "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

15 entries across 15 versions & 2 rubygems

Version Path
code-spec-0.2.8 lib/code_spec/matchers/have_class_self.rb
code-spec-0.2.7 lib/code_spec/matchers/have_class_self.rb
code-spec-0.2.6 lib/code_spec/matchers/have_class_self.rb
code-spec-0.2.5 lib/code_spec/matchers/have_class_self.rb
code-spec-0.2.4 lib/code_spec/matchers/have_class_self.rb
code-spec-0.2.3 lib/code_spec/matchers/have_class_self.rb
code-spec-0.2.2 lib/code_spec/matchers/have_class_self.rb
code-spec-0.2.1 lib/code_spec/matchers/have_class_self.rb
code-spec-0.2.0 lib/code_spec/matchers/have_class_self.rb
code-spec-0.1.3 lib/code_spec/matchers/have_class_self.rb
code-spec-0.1.2 lib/code_spec/matchers/have_class_self.rb
code-spec-0.1.0 lib/code_spec/matchers/have_class_self.rb
generator-spec-0.5.0 lib/generator_spec/matchers/content/have_class_self.rb
generator-spec-0.4.8 lib/generator_spec/matchers/content/have_class_self.rb
generator-spec-0.4.7 lib/generator_spec/matchers/content/have_class_self.rb