Skip to content

Instantly share code, notes, and snippets.

@wycats
Created September 11, 2008 23:58
Show Gist options
  • Save wycats/10345 to your computer and use it in GitHub Desktop.
Save wycats/10345 to your computer and use it in GitHub Desktop.
describe "a request to /foo/bar" do
def login
post("/account/login", "username=myuser&password=awesomepass")
end
def logout
post("/account/logout")
end
before(:each) do
login
get("/foo/bar")
end
after(:each) do
logout
end
it("should be successful") do
rack.status.should == 200
end
it("should show a login page if you're not logged in") do
logout
get("/foo/bar")
rack.status.should == 302
rack.should redirect_to("/account/login")
end
it("should show a page") do
expected = html do
header "User"
element do
User.first.name
end
end
rack.body.should have_contents_like(expected)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment