Fixing enterprise feature spec, adding first shop preference

This commit is contained in:
Rob Harrington
2014-12-17 12:45:41 +11:00
parent 88d49148d4
commit a489aa7ad9
6 changed files with 70 additions and 9 deletions

View File

@@ -47,9 +47,21 @@ angular.module("admin.enterprises")
, 0
$scope.$watch "Enterprise.is_primary_producer", (newValue, oldValue) ->
if newValue
if !newValue && $scope.Enterprise.sells == "none"
$scope.menu.hide_item_by_name('Enterprise Fees')
else
$scope.menu.show_item_by_name('Enterprise Fees')
$scope.$watch "Enterprise.sells", (newValue, oldValue) ->
if newValue == "none"
$scope.menu.hide_item_by_name('Shipping Methods')
$scope.menu.hide_item_by_name('Payment Methods')
else if !newValue
if $scope.Enterprise.is_primary_producer
$scope.menu.show_item_by_name('Enterprise Fees')
else
$scope.menu.hide_item_by_name('Enterprise Fees')
else
$scope.menu.show_item_by_name('Shipping Methods')
$scope.menu.show_item_by_name('Payment Methods')
$scope.menu.show_item_by_name('Enterprise Fees')

View File

@@ -2,6 +2,7 @@
border-right: 2px solid #f6f6f6
border-top: 2px solid #f6f6f6
.menu_item
display: block
padding: 8px 15px
font-size: 120%
cursor: pointer

View File

@@ -3,6 +3,8 @@ class Enterprise < ActiveRecord::Base
SHOP_TRIAL_LENGTH = 30
ENTERPRISE_SEARCH_RADIUS = 100
preference :shopfront_message, :text, default: ""
devise :confirmable, reconfirmable: true, confirmation_keys: [ :id, :email ]
self.inheritance_column = nil

View File

@@ -1,5 +1,6 @@
.side_menu{ ng: { controller: 'sideMenuCtrl' } }
.menu_item{ ng: { repeat: '(index,item) in menu.items',
%a.menu_item{ href: "#", id: "{{ item.name.toLowerCase().replace(' ', '_') }}",
ng: { repeat: '(index,item) in menu.items',
show: "item.visible",
click: 'select(index)',
class: '{ selected: item.selected}',

View File

@@ -1 +1,9 @@
Something
.row
.alpha.eleven.columns
.three.columns.alpha
= f.label "preferred_shopfront_message", t(:shopfront_message)
.eight.columns.omega
-# %text-angular{'ng-model' => 'longDescription', 'id' => 'enterprise_long_description', 'name' => 'enterprise[long_description]', 'class' => 'text-angular',
-# 'ta-toolbar' => "[['h1','h2','h3','h4','p'],['bold','italics','underline','clear'],['insertLink']]",
-# 'placeholder' => 'Tell customers about yourself. This information appears on your public profile.'}
= f.text_area :preferred_shopfront_message, rows: 6, class: "fullwidth", placeholder: "An option explanation for customers detailing how your shopfront works. This text will appear at the top of your shop page, immediately above your products."

View File

@@ -131,24 +131,37 @@ feature %q{
select2_search admin.email, from: 'Owner'
select2_search admin.email, from: 'Owner'
choose 'Any'
check "enterprise_payment_method_ids_#{payment_method.id}"
check "enterprise_shipping_method_ids_#{shipping_method.id}"
select2_search eg1.name, from: 'Groups'
click_link "Payment Methods"
check "enterprise_payment_method_ids_#{payment_method.id}"
click_link "Shipping Methods"
check "enterprise_shipping_method_ids_#{shipping_method.id}"
click_link "Contact"
fill_in 'enterprise_contact', :with => 'Kirsten or Ren'
fill_in 'enterprise_phone', :with => '0413 897 321'
fill_in 'enterprise_email', :with => 'info@eaterprises.com.au'
fill_in 'enterprise_website', :with => 'http://eaterprises.com.au'
click_link "Social"
fill_in 'enterprise_twitter', :with => '@eaterprises'
fill_in 'enterprise_facebook', :with => 'facebook.com/eaterprises'
fill_in 'enterprise_instagram', :with => 'eaterprises'
click_link "Business Details"
fill_in 'enterprise_abn', :with => '09812309823'
fill_in 'enterprise_acn', :with => ''
click_link "Address"
fill_in 'enterprise_address_attributes_address1', :with => '35 Ballantyne St'
fill_in 'enterprise_address_attributes_city', :with => 'Thornbury'
fill_in 'enterprise_address_attributes_zipcode', :with => '3072'
select2_search 'Australia', :from => 'Country'
select2_search 'Victoria', :from => 'State'
click_link "About"
long_description = find :css, "text-angular div.ta-scroll-window div.ta-bind"
long_description.set 'Connecting farmers and eaters'
@@ -176,11 +189,14 @@ feature %q{
fill_in 'enterprise_name', :with => 'Eaterprises'
choose 'Own'
select2_search user.email, from: 'Owner'
click_link "About"
fill_in 'enterprise_description', :with => 'Connecting farmers and eaters'
long_description = find :css, "text-angular div.ta-scroll-window div.ta-bind"
long_description.set 'This is an interesting long description'
# Check Angularjs switching of sidebar elements
click_link "Primary Details"
uncheck 'enterprise_is_primary_producer'
choose 'None'
page.should have_selector "#enterprise_fees", visible: false
@@ -202,26 +218,37 @@ feature %q{
select2_search eg1.name, from: 'Groups'
click_link "Payment Methods"
page.should_not have_checked_field "enterprise_payment_method_ids_#{payment_method.id}"
page.should_not have_checked_field "enterprise_shipping_method_ids_#{shipping_method.id}"
check "enterprise_payment_method_ids_#{payment_method.id}"
click_link "Shipping Methods"
page.should_not have_checked_field "enterprise_shipping_method_ids_#{shipping_method.id}"
check "enterprise_shipping_method_ids_#{shipping_method.id}"
click_link "Contact"
fill_in 'enterprise_contact', :with => 'Kirsten or Ren'
fill_in 'enterprise_phone', :with => '0413 897 321'
fill_in 'enterprise_email', :with => 'info@eaterprises.com.au'
fill_in 'enterprise_website', :with => 'http://eaterprises.com.au'
click_link "Social"
fill_in 'enterprise_twitter', :with => '@eaterprises'
click_link "Business Details"
fill_in 'enterprise_abn', :with => '09812309823'
fill_in 'enterprise_acn', :with => ''
click_link "Address"
fill_in 'enterprise_address_attributes_address1', :with => '35 Ballantyne St'
fill_in 'enterprise_address_attributes_city', :with => 'Thornbury'
fill_in 'enterprise_address_attributes_zipcode', :with => '3072'
select2_search 'Australia', :from => 'Country'
select2_search 'Victoria', :from => 'State'
click_link "Shop Preferences"
fill_in 'enterprise_preferred_shopfront_message', :with => 'This is my shopfront message.'
click_button 'Update'
flash_message.should == 'Enterprise "Eaterprises" has been successfully updated!'
@@ -229,10 +256,20 @@ feature %q{
@enterprise.reload
expect(@enterprise.owner).to eq user
click_link "Payment Methods"
page.should have_checked_field "enterprise_payment_method_ids_#{payment_method.id}"
click_link "Shipping Methods"
page.should have_checked_field "enterprise_shipping_method_ids_#{shipping_method.id}"
page.should have_selector "a.list-item", text: enterprise_fee.name
click_link "Enterprise Fees"
page.should have_selector "td", text: enterprise_fee.name
click_link "About"
page.should have_content 'This is an interesting long description'
click_link "Shop Preferences"
page.should have_field 'enterprise_preferred_shopfront_message', :text => 'This is my shopfront message.'
end
describe "producer properties" do