diff --git a/app/views/spree/admin/distributors/_form.html.haml b/app/views/spree/admin/distributors/_form.html.haml index 72bc885cb7..8f31ecb8f6 100644 --- a/app/views/spree/admin/distributors/_form.html.haml +++ b/app/views/spree/admin/distributors/_form.html.haml @@ -5,6 +5,9 @@ %tr{"data-hook" => "description"} %td Description: %td= f.text_field :description + %tr{'data-hook' => "long_description"} + %td Extended Description: + %td= f.text_area :long_description %tr{"data-hook" => "contact"} %td Contact: %td= f.text_field :contact diff --git a/app/views/spree/admin/distributors/show.html.haml b/app/views/spree/admin/distributors/show.html.haml index 5bb4fb4563..6a745d9cf8 100644 --- a/app/views/spree/admin/distributors/show.html.haml +++ b/app/views/spree/admin/distributors/show.html.haml @@ -6,6 +6,9 @@ %tr %th Description: %td= @distributor.description + %tr + %th Extended Description: + %td= @distributor.long_description %tr %th Contact person: %td= @distributor.contact diff --git a/app/views/spree/admin/suppliers/_form.html.haml b/app/views/spree/admin/suppliers/_form.html.haml index 7f7d69700c..3f76f340d8 100644 --- a/app/views/spree/admin/suppliers/_form.html.haml +++ b/app/views/spree/admin/suppliers/_form.html.haml @@ -5,6 +5,9 @@ %tr{'data-hook' => "description"} %td Description: %td= f.text_field :description + %tr{'data-hook' => "long_description"} + %td Extended Description: + %td= f.text_area :long_description = f.fields_for :address do |address_form| = render 'spree/admin/shared/address_form', :f => address_form %tr{'data-hook' => "email"} diff --git a/app/views/spree/admin/suppliers/show.html.haml b/app/views/spree/admin/suppliers/show.html.haml index b659dbff02..45a601c292 100644 --- a/app/views/spree/admin/suppliers/show.html.haml +++ b/app/views/spree/admin/suppliers/show.html.haml @@ -6,6 +6,9 @@ %tr %th Description: %td= @supplier.description + %tr + %th Extended Description: + %td= @supplier.long_description %tr %th Address: %td= render 'spree/shared/address', :address => @supplier.address diff --git a/spec/requests/admin/distributors_spec.rb b/spec/requests/admin/distributors_spec.rb index eee123b0ac..a4f2a3c8e6 100644 --- a/spec/requests/admin/distributors_spec.rb +++ b/spec/requests/admin/distributors_spec.rb @@ -8,6 +8,25 @@ feature %q{ include WebHelper + scenario "listing distributors" do + d = create(:distributor) + + login_to_admin_section + click_link 'Distributors' + + page.should have_content d.name + end + + scenario "viewing a distributor" do + d = create(:distributor) + + login_to_admin_section + click_link 'Distributors' + click_link d.name + + page.should have_content d.name + end + scenario "creating a new distributor" do login_to_admin_section @@ -16,6 +35,7 @@ feature %q{ fill_in 'distributor_name', :with => 'Eaterprises' fill_in 'distributor_description', :with => 'Connecting farmers and eaters' + fill_in 'distributor_long_description', :with => 'Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro.' fill_in 'distributor_contact', :with => 'Kirsten or Ren' fill_in 'distributor_phone', :with => '0413 897 321' diff --git a/spec/requests/admin/suppliers_spec.rb b/spec/requests/admin/suppliers_spec.rb index 3c7b4deea0..acd91568be 100644 --- a/spec/requests/admin/suppliers_spec.rb +++ b/spec/requests/admin/suppliers_spec.rb @@ -10,29 +10,47 @@ feature %q{ background do end - context "setting up suppliers" do - scenario "creating a new supplier" do - login_to_admin_section + scenario "listing suppliers" do + s = create(:supplier) - click_link 'Suppliers' - click_link 'New Supplier' + login_to_admin_section + click_link 'Suppliers' - fill_in 'supplier_name', :with => 'David Arnold' - fill_in 'supplier_description', :with => 'A farmer with a difference' + page.should have_content s.name + end - fill_in 'supplier_address_attributes_address1', :with => '35 Byron Ave' - fill_in 'supplier_address_attributes_city', :with => 'Ararat' - fill_in 'supplier_address_attributes_zipcode', :with => '1112' - select('Australia', :from => 'supplier_address_attributes_country_id') - select('Victoria', :from => 'supplier_address_attributes_state_id') + scenario "viewing a supplier" do + s = create(:supplier) - fill_in 'supplier_email', :with => 'david@here.com' - fill_in 'supplier_website', :with => 'http://somewhere.com' - fill_in 'supplier_twitter', :with => 'davida' + login_to_admin_section + click_link 'Suppliers' + click_link s.name - click_button 'Create' + page.should have_content s.name + end - flash_message.should == 'Supplier "David Arnold" has been successfully created!' - end + scenario "creating a new supplier" do + login_to_admin_section + + click_link 'Suppliers' + click_link 'New Supplier' + + fill_in 'supplier_name', :with => 'David Arnold' + fill_in 'supplier_description', :with => 'A farmer with a difference' + fill_in 'supplier_long_description', :with => 'Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro.' + + fill_in 'supplier_address_attributes_address1', :with => '35 Byron Ave' + fill_in 'supplier_address_attributes_city', :with => 'Ararat' + fill_in 'supplier_address_attributes_zipcode', :with => '1112' + select('Australia', :from => 'supplier_address_attributes_country_id') + select('Victoria', :from => 'supplier_address_attributes_state_id') + + fill_in 'supplier_email', :with => 'david@here.com' + fill_in 'supplier_website', :with => 'http://somewhere.com' + fill_in 'supplier_twitter', :with => 'davida' + + click_button 'Create' + + flash_message.should == 'Supplier "David Arnold" has been successfully created!' end end