Created
August 29, 2011 02:01
-
-
Save ozzyaaron/1177596 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.dirname(__FILE__) + "/acceptance_helper" | |
describe "Creating an article" do | |
let(:user) { Factory(:user) } | |
context "as a user" do | |
before do | |
login_user(user) | |
end | |
it "should let me access the area" do | |
visit dashboard_user_path(user) | |
click_link "Articles" | |
click_link "Post-an-article" | |
within "#yui-main" do | |
page.should have_content "New Article" | |
page.should have_button "Save" | |
end | |
end | |
it "allowed me to create an article" do | |
visit new_user_post_path(user) | |
within "#yui-main" do | |
fill_in "Title", :with => "Test" | |
fill_in "Content", :with => "Some test content" | |
click_button "Save" | |
end | |
within "#post_detail" do | |
within "#post_title" do | |
page.should have_content "Test" | |
end | |
within ".entry-content" do | |
page.should have_content "Some test content" | |
end | |
end | |
end | |
end | |
context "as a visitor" do | |
it "should NOT let me access the area" do | |
visit dashboard_user_path(user) | |
page.current_path.should == login_path | |
visit new_user_post_path(user) | |
page.current_path.should == login_path | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment