diff --git a/app/views/products/_form.html.haml b/app/views/products/_form.html.haml index 798aa7208..ba05d9eb6 100644 --- a/app/views/products/_form.html.haml +++ b/app/views/products/_form.html.haml @@ -8,10 +8,10 @@ .field = f.label :name - = f.text_field :name + = f.text_field :name, :class => 'input-block-level' .field = f.label :description - = f.text_field :description + = f.text_area :description, :class => 'input-block-level' .field = f.label :min_price = f.text_field :min_price diff --git a/db/migrate/20130606230333_change_product_description_to_text.rb b/db/migrate/20130606230333_change_product_description_to_text.rb new file mode 100644 index 000000000..d20e44f64 --- /dev/null +++ b/db/migrate/20130606230333_change_product_description_to_text.rb @@ -0,0 +1,9 @@ +class ChangeProductDescriptionToText < ActiveRecord::Migration + def up + change_column :products, :description, :text + end + + def down + change_column :products, :description, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 485524431..5d5b92e78 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130601011725) do +ActiveRecord::Schema.define(:version => 20130606230333) do create_table "account_types", :force => true do |t| t.string "name", :null => false @@ -206,11 +206,11 @@ ActiveRecord::Schema.define(:version => 20130601011725) do add_index "posts", ["slug"], :name => "index_updates_on_slug", :unique => true create_table "products", :force => true do |t| - t.string "name", :null => false - t.string "description", :null => false - t.integer "min_price", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.string "name", :null => false + t.text "description", :limit => 255, :null => false + t.integer "min_price", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.integer "account_type_id" t.integer "paid_months" end diff --git a/spec/factories/products.rb b/spec/factories/products.rb index 037350ece..d12723050 100644 --- a/spec/factories/products.rb +++ b/spec/factories/products.rb @@ -3,7 +3,7 @@ FactoryGirl.define do factory :product do name "annual subscription" - description "paid membership, renewing yearly" + description "paid membership, renewing yearly, *hurrah*" min_price "999" account_type paid_months 12 diff --git a/spec/views/products/edit.html.haml_spec.rb b/spec/views/products/edit.html.haml_spec.rb index 26cd392c5..edcd07245 100644 --- a/spec/views/products/edit.html.haml_spec.rb +++ b/spec/views/products/edit.html.haml_spec.rb @@ -15,7 +15,7 @@ describe "products/edit" do # Run the generator again with the --webrat flag if you want to use webrat matchers assert_select "form", :action => products_path(@product), :method => "post" do assert_select "input#product_name", :name => "product[name]" - assert_select "input#product_description", :name => "product[description]" + assert_select "textarea#product_description", :name => "product[description]" assert_select "input#product_min_price", :name => "product[min_price]" end end diff --git a/spec/views/products/new.html.haml_spec.rb b/spec/views/products/new.html.haml_spec.rb index a01ad897d..280f4d7ce 100644 --- a/spec/views/products/new.html.haml_spec.rb +++ b/spec/views/products/new.html.haml_spec.rb @@ -15,7 +15,7 @@ describe "products/new" do # Run the generator again with the --webrat flag if you want to use webrat matchers assert_select "form", :action => products_path, :method => "post" do assert_select "input#product_name", :name => "product[name]" - assert_select "input#product_description", :name => "product[description]" + assert_select "textarea#product_description", :name => "product[description]" assert_select "input#product_min_price", :name => "product[min_price]" assert_select "select#product_account_type_id", :name => "product[account_type_id]" assert_select "input#product_paid_months", :name => "product[paid_months]" diff --git a/spec/views/shop/index_spec.rb b/spec/views/shop/index_spec.rb index dbd678199..2b32fd196 100644 --- a/spec/views/shop/index_spec.rb +++ b/spec/views/shop/index_spec.rb @@ -26,6 +26,10 @@ describe 'shop/index.html.haml', :type => "view" do it 'displays the order form' do assert_select "form", :count => 2 end + + it 'renders markdown in product descriptions' do + assert_select "em", :text => 'hurrah', :count => 2 + end end context "is paid" do