Sha256: dbdc9ca6dfb60f7a4eb158730ab076602b6cd1a7a626c509f6c9441d74f3df1e

Contents?: true

Size: 692 Bytes

Versions: 12

Compression:

Stored size: 692 Bytes

Contents

module RSpec::RubyContentMatchers
  class InheritFrom < RSpec::RubyContentMatcher
    attr_reader :klass

    def initialize klass
      @klass = klass.to_s.camelize
      super @klass
    end

    def index
      1
    end
  
    def failure_message
      super
      "Expected the class to inherit from #{klass}"
    end 
    
    def negative_failure_message
      super
      "Did not expect the class to inherit from #{klass}"
    end
    
    protected

    def main_expr
      'class' + SPACES + Q_ANY_GROUP + '<' + OPT_SPACES + "#{klass}" + ANY_GROUP
    end
  end
  
  def inherit_from(klass)
    InheritFrom.new(klass)
  end 
  alias_method :be_subclass_of, :inherit_from    
end  

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
code-spec-0.2.8 lib/code_spec/matchers/inherit_from.rb
code-spec-0.2.7 lib/code_spec/matchers/inherit_from.rb
code-spec-0.2.6 lib/code_spec/matchers/inherit_from.rb
code-spec-0.2.5 lib/code_spec/matchers/inherit_from.rb
code-spec-0.2.4 lib/code_spec/matchers/inherit_from.rb
code-spec-0.2.3 lib/code_spec/matchers/inherit_from.rb
code-spec-0.2.2 lib/code_spec/matchers/inherit_from.rb
code-spec-0.2.1 lib/code_spec/matchers/inherit_from.rb
code-spec-0.2.0 lib/code_spec/matchers/inherit_from.rb
code-spec-0.1.3 lib/code_spec/matchers/inherit_from.rb
code-spec-0.1.2 lib/code_spec/matchers/inherit_from.rb
code-spec-0.1.0 lib/code_spec/matchers/inherit_from.rb