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

Inherits:
Object
  • Object
show all
Defined in:
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.



25
26
27
# File 'lib/spec/matchers/migration_matchers.rb', line 25

def initialize(table_name)
  @table_name = table_name
end

Instance Attribute Details

#repositoryObject

Returns the value of attribute repository.



23
24
25
# File 'lib/spec/matchers/migration_matchers.rb', line 23

def repository
  @repository
end

#table_nameObject

Returns the value of attribute table_name.



23
24
25
# File 'lib/spec/matchers/migration_matchers.rb', line 23

def table_name
  @table_name
end

Instance Method Details

#failure_messageObject



33
34
35
# File 'lib/spec/matchers/migration_matchers.rb', line 33

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

#matches?(repository) ⇒ Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/spec/matchers/migration_matchers.rb', line 29

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

#negative_failure_messageObject



37
38
39
# File 'lib/spec/matchers/migration_matchers.rb', line 37

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