Sha256: a173e21cd8c41cc035b43221e2c8d5c9cfc6ac09ad2f44791ebc525e45184d4b

Contents?: true

Size: 945 Bytes

Versions: 1

Compression:

Stored size: 945 Bytes

Contents

require 'spec_helper'

describe "posts" do
  # TODO: FG'ize
  let(:forum) { create_forum! }
  let(:topic) { create_topic! }
  
  context "not signed in users " do
    it "cannot begin to post a reply" do
      visit new_topic_post_path(topic)
      flash_error!("You must sign in first.")
    end
  end

  context "signed in users" do
    before do
      sign_in!
      visit forum_topic_path(forum, topic)
      within(selector_for(:first_post)) do
        click_link("Reply")
      end
    end

    it "can post a reply to a topic" do
      fill_in "Text", :with => "Witty and insightful commentary."
      click_button "Post Reply"
      flash_notice!("Your reply has been posted.")
      assert_seen("In reply to #{topic.posts.first.user}", :within => :second_post)
    end
    
    it "cannot post a reply to a topic with blank text" do
      click_button "Post Reply"
      flash_error!("Your reply could not be posted.")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
forem-0.0.1 spec/integration/posts_spec.rb