-
-
Save halorgium/10348 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 "Without logging in" do | |
describe "a request to /foo/bar" do | |
before(:each) do | |
get("/foo/bar") | |
end | |
it "redirects" do | |
rack.status.should == 302 | |
end | |
it "shows a login page") do | |
rack.should redirect_to("/account/login") | |
end | |
end | |
end | |
describe "After logging in" do | |
describe "a request to /foo/bar" do | |
before(:each) do | |
post("/account/login", "username=myuser&password=awesomepass") | |
get("/foo/bar") | |
end | |
it "succeeds" do | |
rack.status.should == 200 | |
end | |
it "shows a page" do | |
expected = html do | |
header "User" | |
element do | |
User.first.name | |
end | |
end | |
rack.body.should have_contents_like(expected) | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment