Class: Remarkable::ActiveRecord::Matchers::ColumnMatcher
- Inherits:
-
Matcher::Base
- Object
- Matcher::Base
- Remarkable::ActiveRecord::Matchers::ColumnMatcher
- Defined in:
- lib/remarkable/active_record/macros/database/have_db_column_matcher.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #negative_failure_message ⇒ Object
-
#of_type(type) ⇒ Object
TODO: remove it.
-
#with_options(opts = {}) ⇒ Object
Method used to load all options via hash.
Methods inherited from Matcher::Base
Methods included from Matcher::DSL
Instance Method Details
#description ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/remarkable/active_record/macros/database/have_db_column_matcher.rb', line 36 def description description = if @columns.size == 1 "have column named :#{@columns[0]}" else "have columns #{@columns.to_sentence}" end description << " with options " + @options.inspect unless @options.empty? description end |
#failure_message ⇒ Object
28 29 30 |
# File 'lib/remarkable/active_record/macros/database/have_db_column_matcher.rb', line 28 def "Expected #{expectation} (#{@missing})" end |
#negative_failure_message ⇒ Object
32 33 34 |
# File 'lib/remarkable/active_record/macros/database/have_db_column_matcher.rb', line 32 def "Did not expect #{expectation}" end |
#of_type(type) ⇒ Object
TODO: remove it
12 13 14 15 16 |
# File 'lib/remarkable/active_record/macros/database/have_db_column_matcher.rb', line 12 def of_type(type) warn "[DEPRECATION] option of_type is deprecated in have_db_column. Use type instead." @options[:type] = type self end |
#with_options(opts = {}) ⇒ Object
Method used to load all options via hash. (:type, :default, :precision, :limit, :scale, :sql_type, :primary, :null)
21 22 23 24 |
# File 'lib/remarkable/active_record/macros/database/have_db_column_matcher.rb', line 21 def (opts = {}) @options.merge!(opts) self end |