Sha256: 913ce52f03dde822053bd30119dec07394ab941af5cf9dfec09ce33e49e22dfe

Contents?: true

Size: 1.05 KB

Versions: 12

Compression:

Stored size: 1.05 KB

Contents

require "rails_helper"

feature "Has many" do
  let!(:school) do
    FactoryBot.create(:school, name: "School of Life")
  end

  let!(:student) do
    FactoryBot.create(:student, name: "John Doe", school: school)
  end

  scenario "index" do
    visit admin_schools_path
    expect(page).to have_content("School of Life")
  end

  scenario "show" do
    visit admin_school_path(school)
    expect(page).to have_content("John Doe")
  end

  scenario "new" do
    visit new_admin_school_path
    expect(page).to have_content("New Schools")
  end

  scenario "create", js: true do
    visit new_admin_school_path
    expect(page).to have_content("New Schools")
    expect(page).to have_content("Add Foo/Student")
    fill_in "Name", with: "La Ferme du Bec Hellouin"
    click_link "Add Foo/Student"
    expect(page).to have_content("Remove Foo/Student")
    within(".nested-fields") do
      fill_in "Name", with: "Sébastien"
    end
    click_button "Create School"
    expect(page).to have_text("La Ferme du Bec Hellouin")
    expect(page).to have_text("Sébastien")
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
viniBaxter-spa-nested_has_many-300.0.6 spec/features/has_many_spec.rb
viniBaxter-spa-nested_has_many-300.0.5 spec/features/has_many_spec.rb
viniBaxter-spa-nested_has_many-300.0.4 spec/features/has_many_spec.rb
viniBaxter-spa-nested_has_many-300.0.2 spec/features/has_many_spec.rb
viniBaxter-spa-nested_has_many-300.0.1 spec/features/has_many_spec.rb
viniBaxter-spa-nested_has_many-5.4.0 spec/features/has_many_spec.rb
viniBaxter-spa-nested_has_many-5.0.1 spec/features/has_many_spec.rb
viniBaxter-spa-nested_has_many-5.0.0 spec/features/has_many_spec.rb
viniBaxter-spa-nested_has_many-4.0.0 spec/features/has_many_spec.rb
viniBaxter-spa-nested_has_many-3.0.0 spec/features/has_many_spec.rb
viniBaxter-spa-nested_has_many-2.0.0 spec/features/has_many_spec.rb
administrate-field-nested_has_many-1.2.0 spec/features/has_many_spec.rb