Class: Rails::Generator::GeneratedAttribute
- Defined in:
- lib/vendor/plugins/rspec-rails/generators/rspec_default_values.rb,
lib/vendor/plugins/rspec-rails/generators/rspec_scaffold/rspec_scaffold_generator.rb
Instance Method Summary collapse
Instance Method Details
#default_value ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/vendor/plugins/rspec-rails/generators/rspec_default_values.rb', line 4 def default_value @default_value ||= case type when :int, :integer then "1" when :float then "1.5" when :decimal then "9.99" when :datetime, :timestamp, :time then "Time.now" when :date then "Date.today" when :string, :text then "\"value for #{@name}\"" when :boolean then "false" when :belongs_to, :references then "1" else "" end end |
#input_type ⇒ Object
145 146 147 148 149 150 151 |
# File 'lib/vendor/plugins/rspec-rails/generators/rspec_scaffold/rspec_scaffold_generator.rb', line 145 def input_type @input_type ||= case type when :text then "textarea" else "input" end end |