Sha256: e7d5cca86eb3e702bb92379d0cac4c240a27c85c403d162afb013823d17a7e70

Contents?: true

Size: 1.34 KB

Versions: 17

Compression:

Stored size: 1.34 KB

Contents

require 'rails_helper'

describe 'Associable' do
  let(:user) { create :user, :developer }

  let(:path) { '/a/cosas/new' }

  before do
    login_as user
    visit path
  end

  it do
    fill_in 'cosa_nombre', with: 'La cosa'
    select 'Los', from: 'cosa_tipo'
    find('.cosa_categoria_de_cosa input[type=text]').click
    expect(page).to have_text :all, 'Nuevo'
    find('.cosa_categoria_de_cosa .list-group-item').click
    select Account.first.to_s
    fill_in 'categoria_de_cosa_nombre', with: 'la categoría'
    select 'Completar', from: 'categoria_de_cosa_tipo'
    click_on 'Agregar Categoría de cosa'
    click_on 'Cargar Coso'
    expect(page).to have_text 'La cosa'
  end

  context 'cuando crea desde el nested' do
    let!(:categ) { create :categoria_de_cosa }
    let(:path) { "/a/categoria_de_cosas/#{categ.hashid}/cosas/new" }

    it do
      input = find_by_id('cosa_categoria_de_cosa')
      expect(input).to be_disabled
    end
  end

  context 'cuando edita desde el nested' do
    let!(:categ) { create :categoria_de_cosa }
    let!(:cosa) { create :cosa, categoria_de_cosa: categ }
    let(:path) { "/a/categoria_de_cosas/#{categ.hashid}/cosas/#{cosa.id}/edit" }

    it do
      ele = find_by_id('cosa_categoria_de_cosa_id', visible: :all)
      input = ele.sibling('input[type=text]')
      expect(input).not_to be_disabled
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
pg_rails-7.6.8 pg_associable/spec/system/associable_spec.rb
pg_rails-7.6.7 pg_associable/spec/system/associable_spec.rb
pg_rails-7.6.6 pg_associable/spec/system/associable_spec.rb
pg_rails-7.6.5 pg_associable/spec/system/associable_spec.rb
pg_rails-7.6.4 pg_associable/spec/system/associable_spec.rb
pg_rails-7.6.3 pg_associable/spec/system/associable_spec.rb
pg_rails-7.6.2 pg_associable/spec/system/associable_spec.rb
pg_rails-7.6.1 pg_associable/spec/system/associable_spec.rb
pg_rails-7.6.0 pg_associable/spec/system/associable_spec.rb
pg_rails-7.5.7 pg_associable/spec/system/associable_spec.rb
pg_rails-7.5.6 pg_associable/spec/system/associable_spec.rb
pg_rails-7.5.5 pg_associable/spec/system/associable_spec.rb
pg_rails-7.5.4 pg_associable/spec/system/associable_spec.rb
pg_rails-7.5.3 pg_associable/spec/system/associable_spec.rb
pg_rails-7.5.2 pg_associable/spec/system/associable_spec.rb
pg_rails-7.5.1 pg_associable/spec/system/associable_spec.rb
pg_rails-7.5.0 pg_associable/spec/system/associable_spec.rb