Sha256: ac7b850112844a19aa2d5087fe113ba96adddb3d28fec42c162dc01c68a77960

Contents?: true

Size: 1018 Bytes

Versions: 7

Compression:

Stored size: 1018 Bytes

Contents

require "rails_helper"

RSpec.feature "Viewing all job postings", type: :system do
  scenario "Accessibility", js: true do
    create_list :job_posting, 1
    visit job_postings_path

    expect(page).to be_accessible
  end

  scenario "N+1 query proteection" do
    job_posting = create :job_posting
    job_posting.comments.create(body: "first comment")
    job_posting.comments.create(body: "second comment")

    another_posting = create :job_posting
    another_posting.comments.create(body: "third comment")
    another_posting.comments.create(body: "fourth comment")

    expect { visit job_postings_path }
      .to raise_error Bullet::Notification::UnoptimizedQueryError
  end

  scenario "Viewing a posting on the page" do
    posting = create :job_posting
    visit job_postings_path

    expect(has_job_posting?(posting)).to be true
  end

  def has_job_posting?(posting)
    within(".job-posting-#{posting.id}") do
      expect(page).to have_css("td.posting-title", text: posting.title)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gnarails-3.0.0 test-app/spec/system/viewing_all_job_postings_spec.rb
gnarails-2.0.0 test-app/spec/system/viewing_all_job_postings_spec.rb
gnarails-1.0.0 test-app/spec/system/viewing_all_job_postings_spec.rb
gnarails-0.9.3 test-app/spec/system/viewing_all_job_postings_spec.rb
gnarails-0.9.2 test-app/spec/system/viewing_all_job_postings_spec.rb
gnarails-0.9.1 test-app/spec/system/viewing_all_job_postings_spec.rb
gnarails-0.9.0 test-app/spec/system/viewing_all_job_postings_spec.rb