Module: RSpec::RubyContentMatchers
- Defined in:
- lib/migration-spec/matchers/content/have_tbl_column.rb,
lib/migration-spec/matchers/content/have_up_down.rb,
lib/migration-spec/matchers/content/have_column.rb,
lib/migration-spec/matchers/content/have_table.rb,
lib/migration-spec/matchers/content/have_index.rb
Defined Under Namespace
Modules: ActiveRecord
Instance Method Summary collapse
- #have_add_index(name) ⇒ Object
- #have_add_tbl_column(tbl_name, col_name, type = 'string') ⇒ Object
- #have_add_tbl_index(tbl_name, index_name) ⇒ Object
- #have_change_table(name) ⇒ Object
- #have_change_tbl_column(tbl_name, col_name, type = 'string') ⇒ Object
- #have_create_table(name) ⇒ Object
- #have_down(&block) ⇒ Object (also: #have_down_method)
- #have_drop_table(name) ⇒ Object
- #have_remove_tbl_column(tbl_name, col_name) ⇒ Object
- #have_remove_tbl_index(tbl_name, index_name) ⇒ Object
- #have_rename_table(name) ⇒ Object
- #have_rename_tbl_column(tbl_name, old_name, new_name) ⇒ Object
- #have_up(&block) ⇒ Object (also: #have_up_method)
Instance Method Details
#have_add_index(name) ⇒ Object
10 11 12 |
# File 'lib/migration-spec/matchers/content/have_index.rb', line 10 def have_add_index(name) have_call 't.add_index', ":#{name}" end |
#have_add_tbl_column(tbl_name, col_name, type = 'string') ⇒ Object
10 11 12 |
# File 'lib/migration-spec/matchers/content/have_tbl_column.rb', line 10 def have_add_tbl_column(tbl_name, col_name, type = 'string') have_call 'add_column', ":#{tbl_name}\s*,\s*:#{col_name}\s*,\s*:#{type}" end |
#have_add_tbl_index(tbl_name, index_name) ⇒ Object
2 3 4 |
# File 'lib/migration-spec/matchers/content/have_index.rb', line 2 def have_add_tbl_index(tbl_name, index_name) have_call 'add_index', :"#{tbl_name}" + '\s*,\s*' + ":#{index_name}" end |
#have_change_table(name) ⇒ Object
6 7 8 |
# File 'lib/migration-spec/matchers/content/have_table.rb', line 6 def have_change_table(name) have_block 'change_table', :args => ":#{name}" end |
#have_change_tbl_column(tbl_name, col_name, type = 'string') ⇒ Object
14 15 16 |
# File 'lib/migration-spec/matchers/content/have_tbl_column.rb', line 14 def have_change_tbl_column tbl_name, col_name, type='string' have_call 'change_column', ":#{tbl_name}\s*,\s*:#{col_name}\s*,\s*:#{type}" end |
#have_create_table(name) ⇒ Object
2 3 4 |
# File 'lib/migration-spec/matchers/content/have_table.rb', line 2 def have_create_table(name) have_block 'create_table', :args => ":#{name}" end |
#have_down(&block) ⇒ Object Also known as: have_down_method
7 8 9 |
# File 'lib/migration-spec/matchers/content/have_up_down.rb', line 7 def have_down &block have_method 'down', :class, &block end |
#have_drop_table(name) ⇒ Object
10 11 12 |
# File 'lib/migration-spec/matchers/content/have_table.rb', line 10 def have_drop_table(name) have_call 'drop_table', ":#{name}" end |
#have_remove_tbl_column(tbl_name, col_name) ⇒ Object
2 3 4 |
# File 'lib/migration-spec/matchers/content/have_tbl_column.rb', line 2 def have_remove_tbl_column(tbl_name, col_name) have_call 'remove_column', ":#{tbl_name}\s*,\s*:#{col_name}" end |
#have_remove_tbl_index(tbl_name, index_name) ⇒ Object
6 7 8 |
# File 'lib/migration-spec/matchers/content/have_index.rb', line 6 def have_remove_tbl_index(tbl_name, index_name) have_call 'remove_index', ":#{tbl_name}" + '\s*,\s*' + ":#{index_name}" end |
#have_rename_table(name) ⇒ Object
14 15 16 |
# File 'lib/migration-spec/matchers/content/have_table.rb', line 14 def have_rename_table(name) have_call 'rename_table', ":#{name}" end |
#have_rename_tbl_column(tbl_name, old_name, new_name) ⇒ Object
6 7 8 |
# File 'lib/migration-spec/matchers/content/have_tbl_column.rb', line 6 def have_rename_tbl_column(tbl_name, old_name, new_name) have_call 'rename_column', ":#{tbl_name}\s*,\s*:#{old_name},\s*:#{new_name}" end |
#have_up(&block) ⇒ Object Also known as: have_up_method
2 3 4 |
# File 'lib/migration-spec/matchers/content/have_up_down.rb', line 2 def have_up &block have_method 'up', :class, &block end |