Sha256: c75aec800fd84d6fed5961a561bf442b24d1f00f77b35f7eaff9017ba1a85e84

Contents?: true

Size: 842 Bytes

Versions: 4

Compression:

Stored size: 842 Bytes

Contents

module RSpec::RubyContentMatchers
  class HaveRegion < RSpec::RubyContentMatcher
    attr_reader :region

    def initialize(region)
      @region = region.to_s
      super @region      
    end
  
    def failure_message 
      super
      display "Expected there to be a #{region} region"
    end 
    
    def negative_failure_message    
      super
      display "Did no expected there to be a #{region} region"
    end               
    
    protected

    def main_expr
      "#{region}" + ANY_GROUP     
    end
    
    def end_expr
      '(private|protected|public|$)'
    end
  end

  def have_region name
    HaveRegion.new name
  end    
  
  def have_public
    HaveRegion.new :public
  end    

  def have_protected
    HaveRegion.new :protected
  end    

  def have_private
    HaveRegion.new :private
  end    
end
      

Version data entries

4 entries across 4 versions & 1 rubygems

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