diff --git a/app/views/admin/enterprises/form/_users.html.haml b/app/views/admin/enterprises/form/_users.html.haml index a62c132592..89696d112b 100644 --- a/app/views/admin/enterprises/form/_users.html.haml +++ b/app/views/admin/enterprises/form/_users.html.haml @@ -14,21 +14,20 @@ - else = owner_email -- if @enterprise.is_distributor - .row - .three.columns.alpha - =f.label :user_ids, t('.notifications') - - if full_permissions - %span.required * - %div{'ofn-with-tip' => t('.contact_tip')} - %a= t('admin.whats_this') - .eight.columns.omega - - if full_permissions - %select.select2.fullwidth{id: 'receives_notifications_dropdown', name: 'receives_notifications', ng: {model: 'receivesNotifications', init: "receivesNotifications = '#{@enterprise.contact.id}'"}} - %option{ng: {repeat: 'user in Enterprise.users', selected: "user.id == #{@enterprise.contact.id}", hide: '!user.confirmed'}, value: '{{user.id}}'} - {{user.email}} - - else - = @enterprise.contact.email +.row + .three.columns.alpha + =f.label :user_ids, t('.notifications') + - if full_permissions + %span.required * + %div{'ofn-with-tip' => t('.contact_tip')} + %a= t('admin.whats_this') + .eight.columns.omega + - if full_permissions + %select.select2.fullwidth{id: 'receives_notifications_dropdown', name: 'receives_notifications', ng: {model: 'receivesNotifications', init: "receivesNotifications = '#{@enterprise.contact.id}'"}} + %option{ng: {repeat: 'user in Enterprise.users', selected: "user.id == #{@enterprise.contact.id}", hide: '!user.confirmed'}, value: '{{user.id}}'} + {{user.email}} + - else + = @enterprise.contact.email .row .three.columns.alpha diff --git a/spec/views/admin/enterprises/form/_users.html.haml_spec.rb b/spec/views/admin/enterprises/form/_users.html.haml_spec.rb deleted file mode 100644 index f6576f64a6..0000000000 --- a/spec/views/admin/enterprises/form/_users.html.haml_spec.rb +++ /dev/null @@ -1,42 +0,0 @@ -# frozen_string_literal: true - -require "spec_helper" - -describe "admin/enterprises/form/_users.html.haml" do - let(:enterprise) { build(:enterprise) } - - before do - assign(:enterprise, enterprise) - admin_user = build(:admin_user) - allow(admin_user).to receive(:admin?) { true } - allow(view).to receive_messages( - f: enterprise_form, - spree_current_user: admin_user, - ) - end - - describe "notifications setting" do - it "is visible when an enterprise is a distributor" do - enterprise.sells = "any" - - render - - expect(rendered).to have_selector("select[name='receives_notifications']") - end - - it "is not visible when an enterprise is a only a profile" do - enterprise.sells = "none" - - render - - expect(rendered).not_to have_selector("select[name='receives_notifications']") - end - end - - private - - def enterprise_form - form_for(enterprise) { |f| @enterprise_form = f } - @enterprise_form - end -end