Sha256: dc352c613cf44fd0e9fdf003426f81bf3cd1290d7163ac719546e7eb5e94d66c

Contents?: true

Size: 885 Bytes

Versions: 2

Compression:

Stored size: 885 Bytes

Contents

require 'spec_helper'

describe "topics"do
	context "authenticated users" do
		before do
			sign_in!
		end

		it "creating a new one"do
			visit topics_path
			click_link "New Topic"
			fill_in "Subject", :with=> "First topic!"
			fill_in "Text", :with=> "First post!"
			click_button "Create Topic"

			within "#flash_notice" do
				page.should have_content("Topic has been created!")
			end

			within ".topic #posts .post"do
				page.should have_content("First post!")
				page.should have_content("forem_user")
			end
		end
	end

	context "unauthenticated users" do
		before do
			sign_out!
		end

		it "cannot see the 'New Topic' link" do
			visit topics_path
			page.should_not have_content("New Topic")
		end

		it "cannot begin to create a new topic" do
			visit new_topic_path
			page.current_url.should eql(sign_in_url)
		end
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
redlumxn-forem-0.0.2 spec/integration/topics_spec.rb
redlumxn-forem-0.0.1 spec/integration/topics_spec.rb