Merge branch 'master' into products-caching

Conflicts:
	spec/features/admin/variant_overrides_spec.rb
This commit is contained in:
Rohan Mitchell
2016-03-18 09:59:56 +11:00
23 changed files with 105 additions and 86 deletions

View File

@@ -47,7 +47,7 @@ feature %q{
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_email_address', :with => 'info@eaterprises.com.au'
fill_in 'enterprise_website', :with => 'http://eaterprises.com.au'
fill_in 'enterprise_address_attributes_address1', :with => '35 Ballantyne St'
@@ -130,7 +130,7 @@ feature %q{
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_email_address', :with => 'info@eaterprises.com.au'
fill_in 'enterprise_website', :with => 'http://eaterprises.com.au'
click_link "Social"
@@ -312,7 +312,7 @@ feature %q{
click_link 'Enterprises'
click_link 'New Enterprise'
fill_in 'enterprise_name', with: 'zzz'
fill_in 'enterprise_email', with: 'bob@example.com'
fill_in 'enterprise_email_address', with: 'bob@example.com'
fill_in 'enterprise_address_attributes_address1', with: 'z'
fill_in 'enterprise_address_attributes_city', with: 'z'
fill_in 'enterprise_address_attributes_zipcode', with: 'z'

View File

@@ -44,7 +44,7 @@ feature %q{
select2_select "PayPal Express", from: "payment_method_type"
click_button 'Update'
expect(flash_message).to eq 'Payment Method has been successfully updated!'
flash_message.should eq 'Payment Method has been successfully updated!'
payment_method = Spree::PaymentMethod.find_by_name('New PM Name')
expect(payment_method.distributors).to include @distributors[1], @distributors[2]

View File

@@ -84,7 +84,7 @@ feature %q{
expect(page).to have_selector "#v_#{variant_related.id}"
select2_select producer.name, from: 'producer_filter'
expect(page).to have_selector "#v_#{variant.id}"
expect(page).to_not have_selector "#v_#{variant_related.id}"
expect(page).to have_no_selector "#v_#{variant_related.id}"
select2_select 'All', from: 'producer_filter'
# Filters based on the quick search box
@@ -92,7 +92,7 @@ feature %q{
expect(page).to have_selector "#v_#{variant_related.id}"
fill_in 'query', with: product.name
expect(page).to have_selector "#v_#{variant.id}"
expect(page).to_not have_selector "#v_#{variant_related.id}"
expect(page).to have_no_selector "#v_#{variant_related.id}"
fill_in 'query', with: ''
# Clears the filters
@@ -100,8 +100,8 @@ feature %q{
expect(page).to have_selector "tr#v_#{variant_related.id}"
select2_select producer.name, from: 'producer_filter'
fill_in 'query', with: product_related.name
expect(page).to_not have_selector "tr#v_#{variant.id}"
expect(page).to_not have_selector "tr#v_#{variant_related.id}"
expect(page).to have_no_selector "tr#v_#{variant.id}"
expect(page).to have_no_selector "tr#v_#{variant_related.id}"
click_button 'Clear All'
expect(page).to have_selector "tr#v_#{variant.id}"
expect(page).to have_selector "tr#v_#{variant_related.id}"
@@ -113,15 +113,15 @@ feature %q{
expect(page).to have_selector "tr#v_#{variant.id}"
expect(page).to have_selector "tr#v_#{variant_related.id}"
within "tr#v_#{variant.id}" do click_button 'Hide' end
expect(page).to_not have_selector "tr#v_#{variant.id}"
expect(page).to have_no_selector "tr#v_#{variant.id}"
expect(page).to have_selector "tr#v_#{variant_related.id}"
first("div#views-dropdown").click
first("div#views-dropdown div.menu div.menu_item", text: "Hidden Products").click
expect(page).to have_selector "tr#v_#{variant.id}"
expect(page).to_not have_selector "tr#v_#{variant_related.id}"
expect(page).to have_no_selector "tr#v_#{variant_related.id}"
within "tr#v_#{variant.id}" do click_button 'Add' end
expect(page).to_not have_selector "tr#v_#{variant.id}"
expect(page).to_not have_selector "tr#v_#{variant_related.id}"
expect(page).to have_no_selector "tr#v_#{variant.id}"
expect(page).to have_no_selector "tr#v_#{variant_related.id}"
first("div#views-dropdown").click
first("div#views-dropdown div.menu div.menu_item", text: "Inventory Products").click
expect(page).to have_selector "tr#v_#{variant.id}"
@@ -319,8 +319,8 @@ feature %q{
end
it "alerts the user to the presence of new products, and allows them to be added or hidden", retry: 3 do
expect(page).to_not have_selector "table#variant-overrides tr#v_#{variant1.id}"
expect(page).to_not have_selector "table#variant-overrides tr#v_#{variant2.id}"
expect(page).to have_no_selector "table#variant-overrides tr#v_#{variant1.id}"
expect(page).to have_no_selector "table#variant-overrides tr#v_#{variant2.id}"
expect(page).to have_selector '.alert-row span.message', text: "There are 1 new products available to add to your inventory."
click_button "Review Now"
@@ -330,17 +330,17 @@ feature %q{
expect(page).to have_selector "table#new-products tr#v_#{variant2.id}"
within "table#new-products tr#v_#{variant1.id}" do click_button 'Add' end
within "table#new-products tr#v_#{variant2.id}" do click_button 'Hide' end
expect(page).to_not have_selector "table#new-products tr#v_#{variant1.id}"
expect(page).to_not have_selector "table#new-products tr#v_#{variant2.id}"
expect(page).to have_no_selector "table#new-products tr#v_#{variant1.id}"
expect(page).to have_no_selector "table#new-products tr#v_#{variant2.id}"
click_button "Back to my inventory"
expect(page).to have_selector "table#variant-overrides tr#v_#{variant1.id}"
expect(page).to_not have_selector "table#variant-overrides tr#v_#{variant2.id}"
expect(page).to have_no_selector "table#variant-overrides tr#v_#{variant2.id}"
first("div#views-dropdown").click
first("div#views-dropdown div.menu div.menu_item", text: "Hidden Products").click
expect(page).to_not have_selector "table#hidden-products tr#v_#{variant1.id}"
expect(page).to have_no_selector "table#hidden-products tr#v_#{variant1.id}"
expect(page).to have_selector "table#hidden-products tr#v_#{variant2.id}"
end
end

View File

@@ -38,7 +38,7 @@ feature "Registration", js: true do
# Filling in Contact Details
expect(page).to have_content 'Who is responsible for managing My Awesome Enterprise?'
fill_in 'enterprise_contact', with: 'Saskia Munroe'
page.should have_field 'enterprise_email', with: user.email
page.should have_field 'enterprise_email_address', with: user.email
fill_in 'enterprise_phone', with: '12 3456 7890'
click_button 'Continue'

View File

@@ -180,7 +180,6 @@ describe Enterprise do
describe "validations" do
subject { FactoryGirl.create(:distributor_enterprise) }
it { should validate_presence_of(:name) }
it { should validate_presence_of(:email) }
it { should validate_uniqueness_of(:permalink) }
it { should ensure_length_of(:description).is_at_most(255) }
@@ -210,9 +209,15 @@ describe Enterprise do
end
it "does not prohibit the saving of an enterprise with no name clash" do
enterprise.email = 'new@email.com'
enterprise.should be_valid
end
it "takes the owner's email address as default email" do
enterprise.email = nil
enterprise.should be_valid
enterprise.email.should be_present
enterprise.email.should eq owner.email
end
end
describe "preferred_shopfront_taxon_order" do