Sha256: 275fa67e7bcfb3eae5e6f75783c579a5cc33f865b9ad34adf6b720f5b5b08c07
Contents?: true
Size: 786 Bytes
Versions: 2
Compression:
Stored size: 786 Bytes
Contents
module RSpec module RubyContentMatchers class HaveClass attr_reader :klass def initialize(klass) @klass = klass end def matches?(content) @content = content match_res = (@content =~ /class\s+#{@klass}\s+(.*)end/m) if block_given? && $1 ruby_content = $1.strip.extend(RSpec::RubyContent::Helpers) yield ruby_content else match_res end end def failure_message "Expected there to be the class #{klass}" end def negative_failure_message "Did no expected there to be the class #{klass}" end end def have_class(klass) HaveClass.new(klass) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rspec_for_generators-0.2.1 | lib/rspec_for_generators/matchers/content/have_class.rb |
rspec_for_generators-0.2.0 | lib/rspec_for_generators/matchers/content/have_class.rb |