Class: Spec::Matchers::Migration::HaveTableMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/gems/dm-migrations-0.9.9/lib/spec/matchers/migration_matchers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table_name) ⇒ HaveTableMatcher

Returns a new instance of HaveTableMatcher.



26
27
28
# File 'lib/gems/dm-migrations-0.9.9/lib/spec/matchers/migration_matchers.rb', line 26

def initialize(table_name)
  @table_name = table_name
end

Instance Attribute Details

#repositoryObject

Returns the value of attribute repository.



24
25
26
# File 'lib/gems/dm-migrations-0.9.9/lib/spec/matchers/migration_matchers.rb', line 24

def repository
  @repository
end

#table_nameObject

Returns the value of attribute table_name.



24
25
26
# File 'lib/gems/dm-migrations-0.9.9/lib/spec/matchers/migration_matchers.rb', line 24

def table_name
  @table_name
end

Instance Method Details

#failure_messageObject



34
35
36
# File 'lib/gems/dm-migrations-0.9.9/lib/spec/matchers/migration_matchers.rb', line 34

def failure_message
  %(expected #{repository} to have table '#{table_name}')
end

#matches?(repository) ⇒ Boolean

Returns:



30
31
32
# File 'lib/gems/dm-migrations-0.9.9/lib/spec/matchers/migration_matchers.rb', line 30

def matches?(repository)
  repository.adapter.storage_exists?(table_name)
end

#negative_failure_messageObject



38
39
40
# File 'lib/gems/dm-migrations-0.9.9/lib/spec/matchers/migration_matchers.rb', line 38

def negative_failure_message
  %(expected #{repository} to not have table '#{table_name}')
end