Sha256: 6a26343e6e73f5cf95d33736fd16ce8fca5d97e01d6ba7f7257b8d4db9645cb1

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

describe 'Shared edit', js: true do
  subject { page }

  let(:user) { get_user }

  before do
    Adminpanel::User.delete_all
    visit adminpanel.signin_path
    valid_signin_as_admin(user)
  end

  after do
    Adminpanel::User.delete_all
  end

  context 'edit' do
    let!(:product) { FactoryGirl.create(:product) }
    let!(:category){ FactoryGirl.create(:category) }

    before do
      product.category_ids = [category.id]
      visit adminpanel.edit_product_path(product)
    end

    it { should have_link('Agregar Categoria') }

    it { should have_content('Test Category') }

    it { should have_title(I18n.t('action.update') + " " + Adminpanel::Product.display_name) }

    describe "with invalid information" do
      before do
        fill_in "product_name", with: ""
        fill_in "product_price", with: ""
        click_button('Guardar Product')
      end

      it 'should have an error alert' do
        should have_content('Producto no pudo guardarse debido a')
      end

      it { should have_title(I18n.t('action.update') + " " + Adminpanel::Product.display_name) }
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
adminpanel-2.1.1 spec/features/shared_pages/edit_spec.rb
adminpanel-2.1.0 spec/features/shared_pages/edit_spec.rb