Created
September 11, 2008 23:58
-
-
Save wycats/10345 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
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