converted product description to text (not string)

This commit is contained in:
Skud
2013-06-07 09:16:18 +10:00
parent d1ddf9a8d2
commit 8046790bc7
7 changed files with 24 additions and 11 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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]"

View File

@@ -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