7. class Awesome
def hello
puts quot;~ Hello ~quot;
end
end
describe Awesome do
it quot;prints helloquot; do
awesome = Awesome.new
awesome.should_receive(:puts)
awesome.hello
end
end
8. class Awesome
def hello
awesome_print quot;~ Hello ~quot;
end
def awesome_print(str)
print quot;#{str}nquot;
end
end
describe Awesome do
it quot;prints helloquot; do
awesome = Awesome.new
awesome.should_receive(:puts)
awesome.hello
end
end
9. class Awesome
def hello
awesome_print quot;~ Hello ~quot;
end
def awesome_print(str)
print quot;#{str}nquot;
end
end
describe Awesome do
it quot;prints helloquot; do
AIL
awesome = Awesome.new
F
awesome.should_receive(:puts)
awesome.hello
end
end
10. class Awesome
def hello
awesome_print quot;~ Hello ~quot;
end
def awesome_print(str)
print quot;#{str}nquot;
end
end
describe Awesome do
it quot;prints helloquot; do
capture { Awesome.new.hello }.
should =~ /Hello/
end
end
19. class Foo < Application
def awesome
awesome_string
end
def awesome_string
quot;Awesomequot;
end
end
Merb::Router.prepare do
match(quot;/foo/awesomequot;).
to(:controller => Foo,
:action => :awesome).
name(:awesome)
end
23. class Bar < Application
def coolness
render
end
end
Merb::Router.prepare do
match(quot;/foo/awesomequot;).
to(:controller => Bar,
:action => :coolness).
name(:awesome)
end
36. it quot;should let you inquot; do
request(quot;/loginquot;, :method => :post,
:params => {:username => quot;userquot;,
:password => quot;passquot;})
request(quot;/homequot;).should be_successful
end
37. it quot;should let you inquot; do
request(quot;/loginquot;, :method => :post,
:params => {:username => quot;userquot;,
:password => quot;passquot;})
request(quot;/homequot;).should be_successful
login
end
38. it quot;should let you inquot; do
request(quot;/loginquot;, :method => :post,
:params => {:username => quot;userquot;,
:password => quot;passquot;})
request(quot;/homequot;).should be_successful
end
you’re logged in
39. describe quot;/loginquot;, :given => quot;successful loginquot; do
it quot;should let you inquot; do
request(quot;/homequot;).should be_successful
end
end
simpler
40. describe quot;/loginquot;, :given => quot;successful loginquot; do
it quot;should let you inquot; do
request(quot;/homequot;).should be_successful
end
end
simpler