Rewrite enterprise contact functionality

This commit is contained in:
Matt-Yorkley
2017-07-28 17:03:00 +01:00
committed by Rob Harrington
parent 22eae753fe
commit ba98c7e2c5
33 changed files with 83 additions and 104 deletions

View File

@@ -4,7 +4,6 @@ angular.module("admin.enterprises")
$scope.PaymentMethods = EnterprisePaymentMethods.paymentMethods
$scope.ShippingMethods = EnterpriseShippingMethods.shippingMethods
$scope.navClear = NavigationCheck.clear
$scope.pristineEmail = $scope.Enterprise.email
$scope.menu = SideMenu
$scope.newManager = { id: '', email: (t('add_manager')) }

View File

@@ -2,7 +2,6 @@ Darkswarm.factory "EnterpriseRegistrationService", ($http, RegistrationService,
new class EnterpriseRegistrationService
enterprise:
user_ids: [CurrentUser.id]
email: CurrentUser.email
email_address: CurrentUser.email
address: {}
country: availableCountries[0]

View File

@@ -2,6 +2,7 @@ module Api
class EnterprisesController < Spree::Api::BaseController
before_filter :override_owner, only: [:create, :update]
before_filter :set_contact, only: [:create]
before_filter :check_type, only: :update
before_filter :override_sells, only: [:create, :update]
before_filter :override_visible, only: [:create, :update]
@@ -53,6 +54,10 @@ module Api
params[:enterprise][:owner_id] = current_api_user.id
end
def set_contact
params[:enterprise][:contact_id] = current_api_user.id
end
def check_type
params[:enterprise].delete :type unless current_api_user.admin?
end

View File

@@ -37,9 +37,7 @@ class UpdateAccountInvoices
if billable_periods.any?
oldest_enterprise = billable_periods.first.enterprise
address = oldest_enterprise.address.dup
first, _space, last = (oldest_enterprise.contact || "").partition(' ')
address.update_attributes(phone: oldest_enterprise.phone) if oldest_enterprise.phone.present?
address.update_attributes(firstname: first, lastname: last) if first.present? && last.present?
account_invoice.order.update_attributes(bill_address: address, ship_address: address)
end

View File

@@ -7,7 +7,7 @@ class EnterpriseMailer < Spree::BaseMailer
subject = t('enterprise_mailer.welcome.subject',
enterprise: @enterprise.name,
sitename: Spree::Config[:site_name])
mail(:to => enterprise.email,
mail(:to => enterprise.contact.email,
:from => from_address,
:subject => subject)
end

View File

@@ -13,11 +13,11 @@ class ProducerMailer < Spree::BaseMailer
subject = "[#{Spree::Config.site_name}] #{I18n.t('producer_mailer.order_cycle.subject', producer: producer.name)}"
if has_orders? order_cycle, producer
mail(to: @producer.email,
mail(to: @producer.contact.email,
from: from_address,
subject: subject,
reply_to: @coordinator.email,
cc: @coordinator.email)
reply_to: @coordinator.contact.email,
cc: @coordinator.contact.email)
end
end

View File

@@ -17,14 +17,14 @@ Spree::OrderMailer.class_eval do
mail(:to => @order.email,
:from => from_address,
:subject => subject,
:reply_to => @order.distributor.email)
:reply_to => @order.distributor.contact.email)
end
def confirm_email_for_shop(order, resend = false)
find_order(order) # Finds an order instance from an id
subject = (resend ? "[#{t(:resend).upcase}] " : '')
subject += "#{Spree::Config[:site_name]} #{t('order_mailer.confirm_email.subject')} ##{@order.number}"
mail(:to => @order.distributor.email,
mail(:to => @order.distributor.contact.email,
:from => from_address,
:subject => subject)
end
@@ -36,7 +36,7 @@ Spree::OrderMailer.class_eval do
mail(:to => @order.email,
:from => from_address,
:subject => subject,
:reply_to => @order.distributor.email)
:reply_to => @order.distributor.contact.email)
end
def find_order(order)

View File

@@ -33,6 +33,7 @@ class Enterprise < ActiveRecord::Base
has_many :enterprise_roles, :dependent => :destroy
has_many :users, through: :enterprise_roles
belongs_to :owner, class_name: 'Spree::User', foreign_key: :owner_id, inverse_of: :owned_enterprises
belongs_to :contact, class_name: 'Spree::User', foreign_key: :contact_id, inverse_of: :contact_enterprises
has_and_belongs_to_many :payment_methods, join_table: 'distributors_payment_methods', class_name: 'Spree::PaymentMethod', foreign_key: 'distributor_id'
has_many :distributor_shipping_methods, foreign_key: :distributor_id
has_many :shipping_methods, through: :distributor_shipping_methods
@@ -69,7 +70,6 @@ class Enterprise < ActiveRecord::Base
validate :name_is_unique
validates :sells, presence: true, inclusion: {in: SELLS}
validates :address, presence: true, associated: true
validates :email, presence: true
validates_presence_of :owner
validates :permalink, uniqueness: true, presence: true
validate :shopfront_taxons
@@ -78,11 +78,11 @@ 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
after_touch :touch_distributors
before_create :set_default_contact
after_create :relate_to_owners_enterprises
after_create :send_welcome_email
@@ -179,7 +179,7 @@ class Enterprise < ActiveRecord::Base
end
def activated?
owner.confirmed? && sells != 'unspecified'
contact.confirmed? && sells != 'unspecified'
end
def set_producer_property(property_name, property_value)
@@ -377,16 +377,16 @@ 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, I18n.t(:enterprise_owner_error, email: owner.email, enterprise_limit: owner.enterprise_limit ))
end
end
def set_default_contact
self.contact_id = self.owner_id if self.contact_id.nil?
end
def relate_to_owners_enterprises
# When a new producer is created, it grants permissions to all pre-existing hubs
# When a new hub is created,

View File

@@ -6,6 +6,7 @@ Spree.user_class.class_eval do
has_many :enterprise_roles, :dependent => :destroy
has_many :enterprises, through: :enterprise_roles
has_many :owned_enterprises, class_name: 'Enterprise', foreign_key: :owner_id, inverse_of: :owner
has_many :contact_enterprises, class_name: 'Enterprise', foreign_key: :contact_id, inverse_of: :contact
has_many :owned_groups, class_name: 'EnterpriseGroup', foreign_key: :owner_id, inverse_of: :owner
has_many :account_invoices
has_many :billable_periods, foreign_key: :owner_id, inverse_of: :owner

View File

@@ -1,12 +1,13 @@
class Api::Admin::EnterpriseSerializer < ActiveModel::Serializer
attributes :name, :id, :is_primary_producer, :is_distributor, :sells, :category, :payment_method_ids, :shipping_method_ids
attributes :producer_profile_only, :email, :long_description, :permalink
attributes :producer_profile_only, :long_description, :permalink
attributes :preferred_shopfront_message, :preferred_shopfront_closed_message, :preferred_shopfront_taxon_order, :preferred_shopfront_order_cycle_order
attributes :preferred_product_selection_from_inventory_only
attributes :owner, :users, :tag_groups, :default_tag_group
attributes :owner, :contact, :users, :tag_groups, :default_tag_group
attributes :require_login, :allow_guest_orders, :allow_order_changes
has_one :owner, serializer: Api::Admin::UserSerializer
has_one :contact, serializer: Api::Admin::UserSerializer
has_many :users, serializer: Api::Admin::UserSerializer
def tag_groups

View File

@@ -44,11 +44,6 @@
&nbsp;
= f.label :sells, t('admin.enterprises.form.primary_details.any'), value: "any"
.row
.alpha.three.columns
= f.label :contact, t('.contact_name')
.omega.nine.columns
= f.text_field :contact, { placeholder: t('admin.enterprises.form.contact.name_placeholder')}
.row
.alpha.three.columns
= f.label :email_address, t('admin.enterprises.form.contact.email_address')

View File

@@ -1,11 +1,8 @@
.row
.alpha.three.columns
= f.label :contact, t('.name')
.omega.eight.columns
= f.text_field :contact, { placeholder: t('.name_placeholder') }
.row
.alpha.three.columns
= f.label :email_address, t('.email_address')
%div{'ofn-with-tip' => t('.email_address_tip')}
%a= t('admin.whats_this')
.omega.eight.columns
= f.text_field :email_address, { placeholder: t('.email_address_placeholder') }
.row

View File

@@ -14,23 +14,26 @@
- else
= owner_email
.row
.three.columns.alpha
= f.label :email, t('.notifications')
- if full_permissions
%span.required *
.with-tip{'data-powertip' => t('.notifications_tip')}
%a= t('admin.whats_this')
.eight.columns.omega
- if full_permissions
= f.text_field :email, { placeholder: t('.notifications_placeholder'), "ng-model" => "Enterprise.email" }
- else
= @enterprise.email
.row{ ng: { hide: "pristineEmail == null || pristineEmail == Enterprise.email"} }
.alpha.three.columns
&nbsp;
.omega.eight.columns
= t('.notifications_note')
-# TODO: add contact field, possibly re-use some of these tooltip keys
-#.row
-# .three.columns.alpha
-# = f.label :email, t('.notifications')
-# - if full_permissions
-# %span.required *
-# .with-tip{'data-powertip' => t('.notifications_tip')}
-# %a= t('admin.whats_this')
-# .eight.columns.omega
-# - if full_permissions
-# = f.text_field :email, { placeholder: t('.notifications_placeholder'), "ng-model" => "Enterprise.email" }
-# - else
-# = @enterprise.email
-#.row{ ng: { hide: "pristineEmail == null || pristineEmail == Enterprise.email"} }
-# .alpha.three.columns
-# &nbsp;
-# .omega.eight.columns
-# = t('.notifications_note')
.row
.three.columns.alpha

View File

@@ -1,5 +1,5 @@
%h3
= "#{t(:email_welcome)}, #{@enterprise.contact}!"
= "#{t(:email_welcome)}!"
%p.lead
= t :email_confirmed
%strong

View File

@@ -71,4 +71,4 @@
%p
#{@coordinator.phone}
%p
#{@coordinator.email}
#{@coordinator.contact.email}

View File

@@ -24,4 +24,4 @@ Orders summary
#{@coordinator.name}
#{@coordinator.address.address1}, #{@coordinator.address.city}, #{@coordinator.address.zipcode}
#{@coordinator.phone}
#{@coordinator.email}
#{@coordinator.contact.email}

View File

@@ -12,14 +12,8 @@
.small-12.medium-12.large-7.columns
.row
.small-12.columns.field
%label{ for: 'enterprise_contact' } {{'enterprise.registration.modal.steps.contact.contact_field' | t}}:
%input.chunky.small-12.columns{ id: 'enterprise_contact', name: 'contact', required: true, placeholder: "{{'enterprise.registration.modal.steps.contact.contact_field_placeholder' | t}}", ng: { model: 'enterprise.contact' } }
%span.error.small-12.columns{ ng: { show: "contact.contact.$error.required && submitted" } }
{{'enterprise.registration.modal.steps.contact.contact_field_required' | t}}
.row
.small-12.columns.field
%label{ for: 'enterprise_email_address' } {{'enterprise.registration.modal.steps.contact.email_field' | t}}:
%input.chunky.small-12.columns{ id: 'enterprise_email_address', name: 'email_address', type: 'email', placeholder: "{{'enterprise.registration.modal.steps.contact.email_field_placeholder' | t}}", ng: { model: 'enterprise.email_address' } }
%label{ for: 'enterprise_email_address' } {{'admin.enterprises.form.contact.email_address' | t}}:
%input.chunky.small-12.columns{ id: 'enterprise_email_address', name: 'email_address', type: 'email', placeholder: t('admin.enterprises.form.contact.email_address_placeholder'), ng: { model: 'enterprise.email_address' } }
.row
.small-12.columns.field
%label{ for: 'enterprise_phone' } {{'enterprise.registration.modal.steps.contact.phone_field' | t}}:

View File

@@ -9,8 +9,4 @@
%p {{'registration_finished_login' | t}}
.row
.small-12.columns.text-center
%h4{ "ng-bind" => "'registration_finished_activate' | t:{enterprise: enterprise.name}" }
%p{ "ng-bind-html" => "'registration_finished_activate_instruction_html' | t:{email: enterprise.email}"}
%a.button.primary{ type: "button", href: "/" } {{'registration_finished_action' | t}} &gt;

View File

@@ -25,7 +25,7 @@
%br
= @order.distributor.address.full_address
%br
= @order.distributor.email
= @order.distributor.contact.email
%td{width: "10%" }
&nbsp;
%td{ :align => "right" }

View File

@@ -18,7 +18,7 @@
'\x0A',
'#{j(@order.distributor.address.address_part1)}' + '\x0A', // text and line break
'#{j(@order.distributor.address.address_part2)}' + '\x0A',
'#{j(@order.distributor.email)}' + '\x0A',
'#{j(@order.distributor.contact.email)}' + '\x0A',
'\x0A', // line break
'\x1B' + '\x61' + '\x32', // right align
'#{j(l(Time.zone.now.to_date))}' + '\x0A',

View File

@@ -2,14 +2,14 @@
%p.callout
= t :email_confirm_customer_signoff
%br
#{@order.distributor.contact}
#{@order.distributor.contact_name}
%br
%br
= @order.distributor.name
%br
= @order.distributor.phone || ""
%br
%a{:href => "mailto:#{@order.distributor.email}", :target => "_blank"}
= @order.distributor.email
%a{:href => "mailto:#{@order.distributor.contact.email}", :target => "_blank"}
= @order.distributor.contact.email
%br
= @order.distributor.website || ""

View File

@@ -4,8 +4,8 @@
%table.column{:align => "left"}
%tr
%td
%h3
= t :email_confirm_shop_greeting, name: @order.distributor.contact
%h3
= t :email_confirm_shop_greeting, name: @order.distributor.contact_name
%h4
= t :email_confirm_shop_order_html, distributor: @order.distributor.name
%table.column{:align => "left"}

View File

@@ -10,7 +10,7 @@
%p
%strong
= t :orders_oc_expired_email
= current_distributor.email
= current_distributor.contact.email
%br/
%strong
= t :orders_oc_expired_phone

View File

@@ -444,8 +444,9 @@ en:
contact:
name: Name
name_placeholder: eg. Gustav Plum
email_address: Email Address
email_address_placeholder: eg. gustav@truffles.com
email_address: Public Email Address
email_address_placeholder: eg. inquiries@fresh-food.com
email_address_tip: "This email address will be displayed in your public profile"
phone: Phone
phone_placeholder: eg. 98 7654 3210
website: Website

View File

@@ -20,11 +20,11 @@ namespace :openfoodnetwork do
end
def enterprise_header
['name', 'description', 'long_description', 'is_primary_producer', 'is_distributor', 'contact', 'phone', 'email', 'website', 'twitter', 'abn', 'acn', 'pickup_times', 'next_collection_at', 'distributor_info', 'visible', 'facebook', 'instagram', 'linkedin', 'address1', 'address2', 'city', 'zipcode', 'state', 'country']
['name', 'description', 'long_description', 'is_primary_producer', 'is_distributor', 'phone', 'email', 'website', 'twitter', 'abn', 'acn', 'pickup_times', 'next_collection_at', 'distributor_info', 'visible', 'facebook', 'instagram', 'linkedin', 'address1', 'address2', 'city', 'zipcode', 'state', 'country']
end
def enterprise_row(enterprise)
[enterprise.name, enterprise.description, enterprise.long_description, enterprise.is_primary_producer, enterprise.is_distributor, enterprise.contact, enterprise.phone, enterprise.email, enterprise.website, enterprise.twitter, enterprise.abn, enterprise.acn, enterprise.pickup_times, enterprise.next_collection_at, enterprise.distributor_info, enterprise.visible, enterprise.facebook, enterprise.instagram, enterprise.linkedin, enterprise.address.address1, enterprise.address.address2, enterprise.address.city, enterprise.address.zipcode, enterprise.address.state_name, enterprise.address.country.andand.name]
[enterprise.name, enterprise.description, enterprise.long_description, enterprise.is_primary_producer, enterprise.is_distributor, enterprise.phone, enterprise.contact.email, enterprise.website, enterprise.twitter, enterprise.abn, enterprise.acn, enterprise.pickup_times, enterprise.next_collection_at, enterprise.distributor_info, enterprise.visible, enterprise.facebook, enterprise.instagram, enterprise.linkedin, enterprise.address.address1, enterprise.address.address2, enterprise.address.city, enterprise.address.zipcode, enterprise.address.state_name, enterprise.address.country.andand.name]
end
end
end

View File

@@ -20,7 +20,7 @@ module Admin
describe "creating an enterprise" do
let(:country) { Spree::Country.find_by_name 'Australia' }
let(:state) { Spree::State.find_by_name 'Victoria' }
let(:enterprise_params) { {enterprise: {name: 'zzz', permalink: 'zzz', is_primary_producer: '0', email: "bob@example.com", address_attributes: {address1: 'a', city: 'a', zipcode: 'a', country_id: country.id, state_id: state.id}}} }
let(:enterprise_params) { {enterprise: {name: 'zzz', permalink: 'zzz', is_primary_producer: '0', address_attributes: {address1: 'a', city: 'a', zipcode: 'a', country_id: country.id, state_id: state.id}}} }
it "grants management permission if the current user is an enterprise user" do
controller.stub spree_current_user: distributor_manager

View File

@@ -152,7 +152,6 @@ FactoryGirl.define do
sells 'any'
description 'enterprise'
long_description '<p>Hello, world!</p><p>This is a paragraph.</p>'
email 'enterprise@example.com'
address { FactoryGirl.create(:address) }
end

View File

@@ -45,7 +45,6 @@ feature %q{
select2_search admin.email, from: 'Owner'
select2_search admin.email, from: 'Owner'
fill_in 'enterprise_contact', :with => 'Kirsten or Ren'
fill_in 'enterprise_phone', :with => '0413 897 321'
fill_in 'enterprise_email_address', :with => 'info@eaterprises.com.au'
fill_in 'enterprise_website', :with => 'http://eaterprises.com.au'
@@ -139,7 +138,6 @@ feature %q{
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_address', :with => 'info@eaterprises.com.au'
fill_in 'enterprise_website', :with => 'http://eaterprises.com.au'

View File

@@ -54,7 +54,6 @@ feature "Registration", js: true do
# Filling in Contact Details
fill_in 'enterprise_contact', with: 'Saskia Munroe'
page.should have_field 'enterprise_email_address', with: user.email
fill_in 'enterprise_phone', with: '12 3456 7890'
perform_and_ensure(:click_button, "Continue", lambda { page.has_content? 'Last step to add My Awesome Enterprise!' })
@@ -68,7 +67,7 @@ feature "Registration", js: true do
expect(e.address.address1).to eq "123 Abc Street"
expect(e.sells).to eq "unspecified"
expect(e.is_primary_producer).to eq true
expect(e.contact).to eq "Saskia Munroe"
expect(e.contact_id).to eq e.owner_id
# Filling in about
fill_in 'enterprise_description', with: 'Short description'
@@ -102,7 +101,6 @@ feature "Registration", js: true do
perform_and_ensure(:click_button, "Continue", lambda { page.has_content? 'Finished!' })
# Done
expect(page).to have_content "We've sent a confirmation email to #{user.email} if it hasn't been activated before."
e.reload
expect(e.website).to eq "www.shop.com"
expect(e.facebook).to eq "FaCeBoOk"

View File

@@ -157,7 +157,7 @@ describe UpdateAccountInvoices do
context "where the order is not complete" do
before do
allow(invoice_order).to receive(:complete?) { false }
june_billable_period1.enterprise.update_attributes(contact: "Firstname Lastname Something Else", phone: '12345')
june_billable_period1.enterprise.update_attributes(phone: '12345')
updater.update(june_account_invoice)
end
@@ -175,8 +175,6 @@ describe UpdateAccountInvoices do
[:address1, :address2, :city, :zipcode, :state_id, :country_id].each do |attr|
expect(invoice_order.billing_address[attr]).to eq june_billable_period1.enterprise.address[attr]
end
expect(invoice_order.billing_address.firstname).to eq "Firstname"
expect(invoice_order.billing_address.lastname).to eq "Lastname Something Else"
expect(invoice_order.billing_address.phone).to eq "12345"
end
@@ -354,7 +352,7 @@ describe UpdateAccountInvoices do
before do
Spree::Config.set({ accounts_distributor_id: accounts_distributor.id })
july_billable_period2.enterprise.update_attributes(contact: 'Anna Karenina', phone: '3433523')
july_billable_period2.enterprise.update_attributes(phone: '3433523')
end
context "when no invoice_order currently exists" do
@@ -377,8 +375,6 @@ describe UpdateAccountInvoices do
[:address1, :address2, :city, :zipcode, :state_id, :country_id].each do |attr|
expect(invoice_order.billing_address[attr]).to eq july_billable_period2.enterprise.address[attr]
end
expect(invoice_order.billing_address.firstname).to eq "Anna"
expect(invoice_order.billing_address.lastname).to eq "Karenina"
expect(invoice_order.billing_address.phone).to eq "3433523"
end
end
@@ -421,8 +417,6 @@ describe UpdateAccountInvoices do
[:address1, :address2, :city, :zipcode, :state_id, :country_id].each do |attr|
expect(invoice_order.billing_address[attr]).to eq july_billable_period2.enterprise.address[attr]
end
expect(invoice_order.billing_address.firstname).to eq "Anna"
expect(invoice_order.billing_address.lastname).to eq "Karenina"
expect(invoice_order.billing_address.phone).to eq "3433523"
end
end

View File

@@ -34,7 +34,7 @@ describe Spree::OrderMailer do
it "sets a reply-to of the enterprise email" do
Spree::OrderMailer.confirm_email_for_customer(@order1.id).deliver
ActionMailer::Base.deliveries.first.reply_to.should == [@distributor.email]
ActionMailer::Base.deliveries.first.reply_to.should == [@distributor.contact.email]
end
end
@@ -42,7 +42,7 @@ describe Spree::OrderMailer do
it "sends an email to the shop owner when given an order" do
Spree::OrderMailer.confirm_email_for_shop(@order1.id).deliver
ActionMailer::Base.deliveries.count.should == 1
ActionMailer::Base.deliveries.first.to.should == [@distributor.email]
ActionMailer::Base.deliveries.first.to.should == [@distributor.contact.email]
end
it "sends an email even if a footer_email is given" do

View File

@@ -59,16 +59,16 @@ describe ProducerMailer do
ActionMailer::Base.deliveries.count.should == 1
end
it "sets a reply-to of the enterprise email" do
mail.reply_to.should == [s1.email]
it "sets a reply-to of the oc coordinator's email" do
expect(mail.reply_to).to eq [order_cycle.coordinator.contact.email]
end
it "includes receival instructions" do
mail.body.encoded.should include 'Outside shed.'
end
it "cc's the enterprise" do
mail.cc.should == [s1.email]
it "cc's the oc coordinator" do
expect(mail.cc).to eq [order_cycle.coordinator.contact.email]
end
it "contains an aggregated list of produce" do

View File

@@ -10,7 +10,7 @@ describe Enterprise do
it "sends a welcome email" do
expect do
create(:enterprise, owner: user, email: enterprise.email)
create(:enterprise, owner: user)
end.to enqueue_job WelcomeEnterpriseJob
end
end
@@ -145,11 +145,9 @@ describe Enterprise do
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
it "sets the enterprise contact to the owner by default" do
enterprise.contact.should be_present
enterprise.contact.should eq enterprise.owner
end
end
@@ -218,13 +216,16 @@ describe Enterprise do
end
describe "activated" do
let!(:inactive_enterprise) { create(:enterprise, sells: "unspecified") ;}
let!(:unconfirmed_user) { create(:user, confirmed_at: nil, enterprise_limit: 2) }
let!(:inactive_enterprise1) { create(:enterprise, sells: "unspecified", owner: unconfirmed_user) }
let!(:inactive_enterprise2) { create(:enterprise, sells: "none", owner: unconfirmed_user) }
let!(:active_enterprise) { create(:enterprise, sells: "none") }
it "finds enterprises that have a sells property other than 'unspecified'" do
it "finds enterprises that have a sells property other than 'unspecified' and have a confirmed user" do
activated_enterprises = Enterprise.activated
expect(activated_enterprises).to include active_enterprise
expect(activated_enterprises).to_not include inactive_enterprise
expect(activated_enterprises).to_not include inactive_enterprise1
expect(activated_enterprises).to_not include inactive_enterprise2
end
end