Sha256: 7a2a92e1d40a9489462bf92ec16cdb7776d581a5c1003cef26e829209f27a9d1

Contents?: true

Size: 949 Bytes

Versions: 4

Compression:

Stored size: 949 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

  scenario "a visitor will see the post's title as the page's title" do
    post = create(:post, published: true, title: 'my title!', summary: 'summary')

    visit exposition.post_path(post)

    expect(page).to have_title('my title!')
    expect(page).to have_css("meta[name='description'][content='summary']",
                             visible: false)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
exposition-0.0.5.7.pre.alpha spec/features/viewing_a_post_spec.rb
exposition-0.0.5.6.pre.alpha spec/features/viewing_a_post_spec.rb
exposition-0.0.5.5.pre.alpha spec/features/viewing_a_post_spec.rb
exposition-0.0.5.4.pre.alpha spec/features/viewing_a_post_spec.rb