Sha256: 0e6bd1faf8c9c01dbc267f7c15f81f832877e9415d64d51ff78b1dd01564e6d9

Contents?: true

Size: 1.11 KB

Versions: 11

Compression:

Stored size: 1.11 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')} #{Adminpanel::Product.display_name}")
  end

  def test_submitting_with_invalid_information
    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(
        $('#product_description').data('wysihtml5').editor.setValue('que pepsi');
      )
    ) # to fill the wysiwyg editor
    click_button('Agregar Producto')
    assert_content(I18n.t('action.save_success'))
    saved_product = Adminpanel::Product.last
    assert_equal 'product name', saved_product.name
    assert_equal '855.5', saved_product.price
    assert_equal 'que pepsi', 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

11 entries across 11 versions & 1 rubygems

Version Path
adminpanel-2.2.5 test/features/shared/resource/new_test.rb
adminpanel-2.2.4 test/features/shared/resource/new_test.rb
adminpanel-2.2.3 test/features/shared/resource/new_test.rb
adminpanel-2.2.2 test/features/shared/resource/new_test.rb
adminpanel-2.2.1 test/features/shared/resource/new_test.rb
adminpanel-2.2.0 test/features/shared/resource/new_test.rb
adminpanel-2.1.7 test/features/shared/resource/new_test.rb
adminpanel-2.1.6 test/features/shared/resource/new_test.rb
adminpanel-2.1.5 test/features/shared/resource/new_test.rb
adminpanel-2.1.3 test/features/shared/resource/new_test.rb
adminpanel-2.1.2 test/features/shared/new_test.rb