Skip to content

Instantly share code, notes, and snippets.

@koriroys
Created February 27, 2012 20:55
Show Gist options
  • Save koriroys/1926968 to your computer and use it in GitHub Desktop.
Save koriroys/1926968 to your computer and use it in GitHub Desktop.
def login_user(email = 'kori', password = 'kori')
user = User.create!(:email => email, :password => password)
post session_path(:email => user.email, :password => user.password)
response.should redirect_to(root_path)
end
def make_valid_post
post posts_path(:title => "whee", :site_link => "whee")
end
describe "a user voting on a thing" do
it "is not allowed unless user is logged in" do
post posts_path(:title => "whee", :site_link => "whee")
response.should redirect_to(login_path)
end
pending "is allowed if logged in user has not voted on that thing" do
login_user
make_valid_post
# vote_on post <--- STUCK HERE
end
pending "is not allowed if logged in user has voted on that that thing" do
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment