Sha256: 1e71250cc791b3315275884807ec1fbbe78b79e734d60728bf66922b017d43b8

Contents?: true

Size: 1.36 KB

Versions: 14

Compression:

Stored size: 1.36 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, 'Nueva categoría de cosa'
    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

14 entries across 14 versions & 1 rubygems

Version Path
pg_rails-7.6.21.pre.2 pg_associable/spec/system/associable_spec.rb
pg_rails-7.6.21.pre.1 pg_associable/spec/system/associable_spec.rb
pg_rails-7.6.20 pg_associable/spec/system/associable_spec.rb
pg_rails-7.6.19 pg_associable/spec/system/associable_spec.rb
pg_rails-7.6.18 pg_associable/spec/system/associable_spec.rb
pg_rails-7.6.17 pg_associable/spec/system/associable_spec.rb
pg_rails-7.6.16 pg_associable/spec/system/associable_spec.rb
pg_rails-7.6.15 pg_associable/spec/system/associable_spec.rb
pg_rails-7.6.14 pg_associable/spec/system/associable_spec.rb
pg_rails-7.6.13 pg_associable/spec/system/associable_spec.rb
pg_rails-7.6.12 pg_associable/spec/system/associable_spec.rb
pg_rails-7.6.11 pg_associable/spec/system/associable_spec.rb
pg_rails-7.6.10 pg_associable/spec/system/associable_spec.rb
pg_rails-7.6.9 pg_associable/spec/system/associable_spec.rb