Skip to content

Commit

Permalink
Hide supplier assignment for now.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Dutil authored and Jeff Dutil committed Jul 23, 2014
1 parent caec60b commit 4606415
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<!-- insert_bottom "[data-hook='admin_product_form_right'], #admin_product_form_right[data-hook]" -->

<% if can? :manage, Spree::Supplier %>
<%= f.field_container :supplier do %>
<%= f.label :supplier_id, Spree.t(:supplier) %>
<%= f.collection_select(:supplier_id, @suppliers, :id, :name, { include_blank: 'None' }, { class: 'select2' }) %>
<%= f.error_message_on :supplier %>
<% end %>
<!-- TODO allow assignment to variants -->
<% end %>
2 changes: 1 addition & 1 deletion lib/tasks/spree_sample.rake
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace :spree_sample do

puts "Linking existing line items to suppliers"
Spree::LineItem.all.each do |li|
print "*" if li.product.supplier_id = @suppliers.shuffle.first.id and li.save
print "*" if li.product.add_supplier! @suppliers.shuffle.first.id and li.save
end
puts

Expand Down
25 changes: 25 additions & 0 deletions spec/features/admin/products_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require 'spec_helper'

describe 'Admin - Products', js: true do

context 'as Admin' do

xit 'should be able to change supplier' do
s1 = create(:supplier)
s2 = create(:supplier)
product = create :product
product.add_supplier! s1

login_user create(:admin_user)
visit spree.admin_product_path(product)

select2 s2.name, from: 'Supplier'
click_button 'Update'

expect(page).to have_content("Product \"#{product.name}\" has been successfully updated!")
expect(product.reload.suppliers.first.id).to eql(s2.id)
end

end

end

0 comments on commit 4606415

Please sign in to comment.