Sha256: c3e3302479d9514a7b5b7440eb423243678bc15ccd08c11a5641ce60e17a3f14

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

# encoding: UTF-8
require 'spec_helper'

describe 'Product Details' do
  stub_authorization!

  before do
    create(:product, :name => 'Test Product', :sku => 'A100',
      :description => 'lorem ipsum', :available_on => Date.today - 1.month)
    create(:product, :name => 'Test Product 2', :sku => 'A100',
      :description => 'lorem ipsum', :available_on => Date.today - 1.month)
    visit spree.admin_products_path
    within_row(1) { click_icon :edit }
    click_link 'Product Details'
  end

  context 'editing a product' do
    it 'should list the product details' do
      find('input#product_inactive').value.should == '1'
    end

    it 'should list the product without inactive products' do
      find('input#product_inactive').set true
      click_button "Update"

      Spree::Product.count.should == 2
      Spree::Product.without_inactive.count.should == 1
    end

    it 'should list the product with inactive products' do
      find('input#product_inactive').set false
      click_button "Update"

      Spree::Product.count.should == 2
      Spree::Product.without_inactive.count.should == 2
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_product_activator-1.0.0 spec/features/admin/products_spec.rb