mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Merge branch 'master' into products-caching
Conflicts: spec/features/admin/variant_overrides_spec.rb
This commit is contained in:
@@ -2,7 +2,7 @@ Darkswarm.factory "EnterpriseRegistrationService", ($http, RegistrationService,
|
||||
new class EnterpriseRegistrationService
|
||||
enterprise:
|
||||
user_ids: [CurrentUser.id]
|
||||
email: CurrentUser.email
|
||||
email_address: CurrentUser.email
|
||||
address: {}
|
||||
country: availableCountries[0]
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
%div.contact-container{bindonce: true}
|
||||
%div.modal-centered{"bo-if" => "enterprise.email || enterprise.website || enterprise.phone"}
|
||||
%div.modal-centered{"bo-if" => "enterprise.email_address || enterprise.website || enterprise.phone"}
|
||||
%p.modal-header {{'contact' | t}}
|
||||
%p{"bo-if" => "enterprise.phone", "bo-text" => "enterprise.phone"}
|
||||
|
||||
%p.word-wrap{"ng-if" => "enterprise.email"}
|
||||
%a{"bo-href" => "enterprise.email | stripUrl", target: "_blank", mailto: true}
|
||||
%span.email{"bo-bind" => "enterprise.email | stripUrl"}
|
||||
%p.word-wrap{"ng-if" => "enterprise.email_address"}
|
||||
%a{"bo-href" => "enterprise.email_address | stripUrl", target: "_blank", mailto: true}
|
||||
%span.email{"bo-bind" => "enterprise.email_address | stripUrl"}
|
||||
|
||||
%p.word-wrap{"ng-if" => "enterprise.website"}
|
||||
%a{"bo-href-i" => "http://{{enterprise.website | stripUrl}}", target: "_blank", "bo-bind" => "enterprise.website | stripUrl"}
|
||||
|
||||
@@ -17,28 +17,13 @@
|
||||
{{'enterprise_contact_required' | t}}
|
||||
.row
|
||||
.small-12.columns.field
|
||||
%label{ for: 'enterprise_email' } {{'enterprise_email' | t}}:
|
||||
%input.chunky.small-12.columns{ id: 'enterprise_email', name: 'email', type: 'email', required: true, placeholder: "eg. charlie@thefarm.com", ng: { model: 'enterprise.email' } }
|
||||
%span.error.small-12.columns{ ng: { show: "(contact.email.$error.email || contact.email.$error.required) && submitted" } }
|
||||
{{'enterprise_email_required' | t}}
|
||||
%label{ for: 'enterprise_email_address' } {{'enterprise_email_address' | t}}:
|
||||
%input.chunky.small-12.columns{ id: 'enterprise_email_address', name: 'email_address', type: 'email', placeholder: "eg. charlie@thefarm.com", ng: { model: 'enterprise.email_address' } }
|
||||
.row
|
||||
.small-12.columns.field
|
||||
%label{ for: 'enterprise_phone' } {{'enterprise_phone' | t}}:
|
||||
%input.chunky.small-12.columns{ id: 'enterprise_phone', name: 'phone', placeholder: "eg. (03) 1234 5678", ng: { model: 'enterprise.phone' } }
|
||||
.small-12.medium-12.large-5.hide-for-small-only
|
||||
/ %h6
|
||||
/ Contact display
|
||||
/ %i.ofn-i_013-help.has-tip{ 'data-tooltip' => true, title: "Choose how you want to display your contact details on the Open Food Network."}
|
||||
/ .row
|
||||
/ .small-12.columns
|
||||
/ %label.indent-checkbox
|
||||
/ %input{ type: 'checkbox', id: 'contact_name_profile', ng: { model: 'enterprise.name_in_profile' } } Display name in profile
|
||||
/ .small-12.columns
|
||||
/ %label.indent-checkbox
|
||||
/ %input{ type: 'checkbox', id: 'contact_email_profile', ng: { model: 'enterprise.email_in_profile' } } Display email in profile
|
||||
/ .small-12.columns
|
||||
/ %label.indent-checkbox
|
||||
/ %input{ type: 'checkbox', id: 'contact_phone_profile', ng: { model: 'enterprise.phone_in_profile' } } Display phone in profile
|
||||
|
||||
.row.buttons
|
||||
.small-12.columns
|
||||
|
||||
@@ -62,10 +62,8 @@
|
||||
// ABOUT Enterprise
|
||||
|
||||
.about-container
|
||||
max-height: 200px
|
||||
min-height: 20px
|
||||
margin-bottom: 0.5rem
|
||||
overflow-y: scroll
|
||||
overflow-x: hidden
|
||||
border-bottom: 1px solid $light-grey
|
||||
@include box-shadow(0 2px 2px -2px $light-grey)
|
||||
|
||||
@@ -81,6 +81,7 @@ class Enterprise < ActiveRecord::Base
|
||||
|
||||
before_validation :initialize_permalink, if: lambda { permalink.nil? }
|
||||
before_validation :ensure_owner_is_manager, if: lambda { owner_id_changed? && !owner_id.nil? }
|
||||
before_validation :ensure_email_set
|
||||
before_validation :set_unused_address_fields
|
||||
after_validation :geocode_address
|
||||
|
||||
@@ -409,6 +410,10 @@ class Enterprise < ActiveRecord::Base
|
||||
users << owner unless users.include?(owner) || owner.admin?
|
||||
end
|
||||
|
||||
def ensure_email_set
|
||||
self.email = owner.email if email.blank? && owner.present?
|
||||
end
|
||||
|
||||
def enforce_ownership_limit
|
||||
unless owner.can_own_more_enterprises?
|
||||
errors.add(:owner, "^#{owner.email} is not permitted to own any more enterprises (limit is #{owner.enterprise_limit}).")
|
||||
|
||||
@@ -41,7 +41,7 @@ class Api::CachedEnterpriseSerializer < ActiveModel::Serializer
|
||||
attributes :name, :id, :description, :latitude, :longitude,
|
||||
:long_description, :website, :instagram, :linkedin, :twitter,
|
||||
:facebook, :is_primary_producer, :is_distributor, :phone, :visible,
|
||||
:email, :hash, :logo, :promo_image, :path, :pickup, :delivery,
|
||||
:email_address, :hash, :logo, :promo_image, :path, :pickup, :delivery,
|
||||
:icon, :icon_font, :producer_icon_font, :category, :producers, :hubs
|
||||
|
||||
attributes :taxons, :supplied_taxons
|
||||
@@ -67,8 +67,8 @@ class Api::CachedEnterpriseSerializer < ActiveModel::Serializer
|
||||
services ? services[:delivery] : false
|
||||
end
|
||||
|
||||
def email
|
||||
object.email.to_s.reverse
|
||||
def email_address
|
||||
object.email_address.to_s.reverse
|
||||
end
|
||||
|
||||
def hash
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
= content_for :page_title do
|
||||
Enterprise Groups
|
||||
|
||||
= content_for :page_actions do
|
||||
%li#new_enterprise_group_link
|
||||
= button_link_to "New Enterprise Group", main_app.new_admin_enterprise_group_path, :icon => 'add', :id => 'admin_new_enterprise_group_link'
|
||||
- if admin_user?
|
||||
= content_for :page_actions do
|
||||
%li= button_link_to "New Enterprise Group", main_app.new_admin_enterprise_group_path
|
||||
|
||||
%table.index#listing_enterprise_groups
|
||||
%thead
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
.row
|
||||
.three.columns.alpha
|
||||
= f.label :name
|
||||
%span.required *
|
||||
.nine.columns.omega
|
||||
= f.text_field :name, { placeholder: "eg. Professor Plum's Biodynamic Truffles", class: "fullwidth" }
|
||||
|
||||
@@ -8,6 +9,7 @@
|
||||
.row
|
||||
.three.columns.alpha
|
||||
=f.label :owner_id, 'Owner'
|
||||
%span.required *
|
||||
%div{'ofn-with-tip' => "The primary user responsible for this enterprise."}
|
||||
%a What's this?
|
||||
.nine.columns.omega
|
||||
@@ -50,13 +52,9 @@
|
||||
= f.text_field :contact, { placeholder: "eg. Gustav Plum"}
|
||||
.row
|
||||
.alpha.three.columns
|
||||
= f.label :email
|
||||
= f.label :email_address
|
||||
.omega.nine.columns
|
||||
= f.text_field :email, { placeholder: "eg. gustav@truffles.com", "ng-model" => "Enterprise.email" }
|
||||
.alert-box
|
||||
%i.icon-info-sign
|
||||
If we don't recognise this email address we'll send you a confirmation email to make sure it belongs to you. You'll need to use the link in the email we send to fully activate your new enterprise.
|
||||
%a.close{ href: "" } ×
|
||||
= f.text_field :email_address, { placeholder: "eg. gustav@truffles.com", "ng-model" => "Enterprise.email_address" }
|
||||
.row
|
||||
.alpha.three.columns
|
||||
= f.label :phone
|
||||
@@ -72,6 +70,7 @@
|
||||
.row
|
||||
.three.columns.alpha
|
||||
= af.label :address1
|
||||
%span.required *
|
||||
.nine.columns.omega
|
||||
= af.text_field :address1, { placeholder: "eg. 123 High Street"}
|
||||
.row
|
||||
@@ -84,6 +83,7 @@
|
||||
= af.label :city, 'Suburb'
|
||||
\/
|
||||
= af.label :zipcode, 'Postcode'
|
||||
%span.required *
|
||||
.four.columns
|
||||
= af.text_field :city, { placeholder: "eg. Northcote"}
|
||||
.five.columns.omega
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
-if @enterprise.pending_any_confirmation?
|
||||
.alert-box
|
||||
- email = @enterprise.confirmed? ? @enterprise.unconfirmed_email : @enterprise.email
|
||||
Email confirmation is pending.
|
||||
We've sent a confirmation email to
|
||||
%strong= "#{email}."
|
||||
= link_to('Resend', main_app.enterprise_confirmation_path(enterprise: { id: @enterprise.id, email: email } ), method: :post)
|
||||
%a.close{ href: "#" } ×
|
||||
.row
|
||||
.alpha.three.columns
|
||||
= f.label :contact, 'Name'
|
||||
@@ -13,15 +5,9 @@
|
||||
= f.text_field :contact, { placeholder: "eg. Gustav Plum"}
|
||||
.row
|
||||
.alpha.three.columns
|
||||
= f.label :email
|
||||
%span.required *
|
||||
= f.label :email_address
|
||||
.omega.eight.columns
|
||||
= f.text_field :email, { placeholder: "eg. gustav@truffles.com", "ng-model" => "Enterprise.email" }
|
||||
.row{ ng: { hide: "pristineEmail == null || pristineEmail == Enterprise.email"} }
|
||||
.alpha.three.columns
|
||||
|
||||
.omega.eight.columns
|
||||
Note: A new email address may need to be confirmed prior to use
|
||||
= f.text_field :email_address, { placeholder: "eg. gustav@truffles.com" }
|
||||
.row
|
||||
.alpha.three.columns
|
||||
= f.label :phone
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
- owner_email = @enterprise.andand.owner.andand.email || ""
|
||||
- full_permissions = (spree_current_user.admin? || spree_current_user == @enterprise.andand.owner)
|
||||
|
||||
-if @enterprise.pending_any_confirmation?
|
||||
.alert-box
|
||||
- email = @enterprise.confirmed? ? @enterprise.unconfirmed_email : @enterprise.email
|
||||
Email confirmation is pending.
|
||||
We've sent a confirmation email to
|
||||
%strong= "#{email}."
|
||||
= link_to('Resend', main_app.enterprise_confirmation_path(enterprise: { id: @enterprise.id, email: email } ), method: :post)
|
||||
%a.close{ href: "#" } ×
|
||||
|
||||
.row
|
||||
.three.columns.alpha
|
||||
=f.label :owner_id, 'Owner'
|
||||
@@ -14,6 +23,24 @@
|
||||
- else
|
||||
= owner_email
|
||||
|
||||
.row
|
||||
.three.columns.alpha
|
||||
= f.label :email, 'Notifications'
|
||||
- if full_permissions
|
||||
%span.required *
|
||||
.with-tip{'data-powertip' => "Notifications about orders will be send to this email address."}
|
||||
%a What's this?
|
||||
.eight.columns.omega
|
||||
- if full_permissions
|
||||
= f.text_field :email, { placeholder: "eg. gustav@truffles.com", "ng-model" => "Enterprise.email" }
|
||||
- else
|
||||
= @enterprise.email
|
||||
.row{ ng: { hide: "pristineEmail == null || pristineEmail == Enterprise.email"} }
|
||||
.alpha.three.columns
|
||||
|
||||
.omega.eight.columns
|
||||
Note: A new email address may need to be confirmed prior to use
|
||||
|
||||
.row
|
||||
.three.columns.alpha
|
||||
=f.label :user_ids, 'Managers'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
attributes :name, :id, :description, :latitude, :longitude, :long_description, :website, :instagram, :linkedin, :twitter, :facebook, :is_primary_producer, :is_distributor, :phone
|
||||
|
||||
node :email do |enterprise|
|
||||
enterprise.email.to_s.reverse
|
||||
node :email_address do |enterprise|
|
||||
enterprise.email_address.to_s.reverse
|
||||
end
|
||||
|
||||
child :address do
|
||||
|
||||
@@ -12,6 +12,6 @@
|
||||
= t :ocs_closed_opens, time: distance_of_time_in_words_to_now(next_oc.orders_open_at)
|
||||
|
||||
%p
|
||||
= t(:ocs_closed_email, email: current_distributor.email) if current_distributor.email
|
||||
= t(:ocs_closed_email, email: current_distributor.email_address) if current_distributor.email_address
|
||||
%br/
|
||||
= t(:ocs_closed_phone, phone: current_distributor.phone) if current_distributor.phone
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
%div.show-for-medium-up{"ng-if" => "producer.supplied_taxons.length==0"}
|
||||
|
||||
|
||||
%div{"bo-if" => "producer.email || producer.website || producer.phone"}
|
||||
%div{"bo-if" => "producer.email_address || producer.website || producer.phone"}
|
||||
%label
|
||||
= t :producers_contact
|
||||
|
||||
@@ -31,9 +31,9 @@
|
||||
= t :producers_contact_phone
|
||||
%span{"bo-text" => "producer.phone"}
|
||||
|
||||
%p.word-wrap{"bo-if" => "producer.email"}
|
||||
%a{"bo-href" => "producer.email | stripUrl", target: "_blank", mailto: true}
|
||||
%span.email{"bo-bind" => "producer.email | stripUrl"}
|
||||
%p.word-wrap{"bo-if" => "producer.email_address"}
|
||||
%a{"bo-href" => "producer.email_address | stripUrl", target: "_blank", mailto: true}
|
||||
%span.email{"bo-bind" => "producer.email_address | stripUrl"}
|
||||
|
||||
%p.word-wrap{"bo-if" => "producer.website"}
|
||||
%a{"bo-href-i" => "http://{{producer.website | stripUrl}}", target: "_blank" }
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
= current_distributor.address.zipcode
|
||||
|
||||
.small-12.large-4.columns
|
||||
- if current_distributor.website || current_distributor.email
|
||||
- if current_distributor.website || current_distributor.email_address
|
||||
%div.center
|
||||
.header
|
||||
= t :shopping_contact_web
|
||||
@@ -27,10 +27,10 @@
|
||||
%a{href: "http://#{current_distributor.website}", target: "_blank" }
|
||||
= current_distributor.website
|
||||
%br
|
||||
- unless current_distributor.email.blank?
|
||||
%a{href: current_distributor.email.reverse, mailto: true}
|
||||
- unless current_distributor.email_address.blank?
|
||||
%a{href: current_distributor.email_address.reverse, mailto: true}
|
||||
%span.email
|
||||
= current_distributor.email.reverse
|
||||
= current_distributor.email_address.reverse
|
||||
|
||||
.small-12.large-4.columns
|
||||
- if current_distributor.twitter.present? || current_distributor.facebook.present? || current_distributor.linkedin.present? || current_distributor.instagram.present?
|
||||
|
||||
@@ -602,8 +602,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
|
||||
who_is_managing_enterprise: "Who is responsible for managing %{enterprise}?"
|
||||
enterprise_contact: "Primary Contact"
|
||||
enterprise_contact_required: "You need to enter a primary contact."
|
||||
enterprise_email: "Email address"
|
||||
enterprise_email_required: "You need to enter valid email address."
|
||||
enterprise_email_address: "Email address"
|
||||
enterprise_phone: "Phone number"
|
||||
back: "Back"
|
||||
continue: "Continue"
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddEmailAddressToEnterprises < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :enterprises, :email_address, :string
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,8 @@
|
||||
class SetEnterpriseEmailAddress < ActiveRecord::Migration
|
||||
def up
|
||||
Enterprise.all.each do |enterprise|
|
||||
enterprise.email_address = enterprise.email
|
||||
enterprise.save
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -347,6 +347,7 @@ ActiveRecord::Schema.define(:version => 20160302044850) do
|
||||
t.boolean "producer_profile_only", :default => false
|
||||
t.string "permalink", :null => false
|
||||
t.boolean "charges_sales_tax", :default => false, :null => false
|
||||
t.string "email_address"
|
||||
end
|
||||
|
||||
add_index "enterprises", ["address_id"], :name => "index_enterprises_on_address_id"
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user