Sha256: e5d98d98960c2b0356e7bbbd2ea5fa90d39944d5ce2f7c64c6565c503bda020d

Contents?: true

Size: 584 Bytes

Versions: 5

Compression:

Stored size: 584 Bytes

Contents

require "rails_helper"

RSpec.feature "Viewing a post", :type => :feature do
  scenario "a visitor can view published posts" do
    post = create(:post, published: true)

    visit exposition_path
    click_link(post.title)

    expect(current_path).to eq(exposition.post_path(post))
    expect(page).to have_text(post.title)
    expect(page).to have_text(post.body)
  end

  scenario "a visitor cannot view unpublished posts" do
    post = create(:post, published: false)

    expect { visit exposition.post_path(post) }.
      to raise_error(ActiveRecord::RecordNotFound)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
exposition-0.0.5.2.pre.alpha spec/features/viewing_a_post_spec.rb
exposition-0.0.5.1.pre.alpha spec/features/viewing_a_post_spec.rb
exposition-0.0.5.pre.alpha spec/features/viewing_a_post_spec.rb
exposition-0.0.4.pre.alpha spec/features/viewing_a_post_spec.rb
exposition-0.0.3.pre.alpha spec/features/viewing_a_post_spec.rb