Sha256: 0b1b28f80d965c5d3be2187f00eedd20f68633183fde3b514fc47108c68f5288

Contents?: true

Size: 1.17 KB

Versions: 18

Compression:

Stored size: 1.17 KB

Contents

require 'test_helper'

class NewTest < ViewCase

  setup :visit_adminpanel_new_product_path
  teardown :teardown

  def test_shared_new_page_messages
    assert_button(I18n.t('action.add', resource: Adminpanel::Product.display_name))
  end

  def test_submitting_with_invalid_information
    sleep 0.2
    click_button('Agregar Producto')
    assert_content('Producto no pudo guardarse debido a 3 errores')
  end

  def test_submitting_with_valid_information
    fill_in 'product_name', with: 'product name'
    fill_in 'product_price', with: '855.5'


    page.execute_script(
      %Q(
        var editor = $('#description-trix-editor')[0].editor;
        editor.insertString("Que pepsi");
      )
    ) # to fill the wysiwyg editor
    click_button('Agregar Producto')
    assert_content('product name')
    assert_content('855.5')
    saved_product = Adminpanel::Product.last
    assert_equal 'product name', saved_product.name
    assert_equal '855.5', saved_product.price
    assert_equal '<div>Que pepsi</div>', saved_product.description
  end

  protected
  def visit_adminpanel_new_product_path
    visit adminpanel.signin_path
    login
    visit adminpanel.new_product_path
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
adminpanel-3.6.1 test/features/shared/resource/new_test.rb
adminpanel-3.6.0 test/features/shared/resource/new_test.rb
adminpanel-3.5.1 test/features/shared/resource/new_test.rb
adminpanel-3.5.0 test/features/shared/resource/new_test.rb
adminpanel-3.4.7 test/features/shared/resource/new_test.rb
adminpanel-3.4.6 test/features/shared/resource/new_test.rb
adminpanel-3.4.5 test/features/shared/resource/new_test.rb
adminpanel-3.4.4 test/features/shared/resource/new_test.rb
adminpanel-3.4.3 test/features/shared/resource/new_test.rb
adminpanel-3.4.2 test/features/shared/resource/new_test.rb
adminpanel-3.4.1 test/features/shared/resource/new_test.rb
adminpanel-3.4.0 test/features/shared/resource/new_test.rb
adminpanel-3.3.4 test/features/shared/resource/new_test.rb
adminpanel-3.3.3 test/features/shared/resource/new_test.rb
adminpanel-3.3.0 test/features/shared/resource/new_test.rb
adminpanel-3.2.1 test/features/shared/resource/new_test.rb
adminpanel-3.2.0 test/features/shared/resource/new_test.rb
adminpanel-3.1.0 test/features/shared/resource/new_test.rb