Sha256: b44cf57fb9d2d4edba05717ee448ba36e0db0e383a7dfe7f42ac6802e92cf012
Contents?: true
Size: 730 Bytes
Versions: 2
Compression:
Stored size: 730 Bytes
Contents
module RSpec::RubyContentMatchers class HaveMigration attr_reader :klass def initialize(klass) @klass = klass.to_s.camelize end def matches?(content) match_res = (content =~ /class\s+#{klass}\s+<\s+ActiveRecord::Migration(.*)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 migration class #{klass}" end def negative_failure_message "Did no expected there to be the migration class #{klass}" end end def have_migration(klass) HaveMigration.new(klass) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
generator-spec-0.3.5 | lib/rspec_for_generators/matchers/migration/have_migration.rb |
generator-spec-0.3.4 | lib/rspec_for_generators/matchers/migration/have_migration.rb |