Created
September 25, 2008 17:11
-
-
Save jackdempsey/12863 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class Home < Application | |
def app_status | |
repository.adapter.execute("show tables") | |
'ok' | |
end | |
end | |
describe Home, "app_status action" do | |
it "should render 'ok' if db is connecting correctly" do | |
mock(adapter = Object.new).execute("show tables") | |
mock(db = Object.new).adapter { adapter } | |
mock.instance_of(Home).repository { db } | |
dispatch_to(Home, :app_status).body.should == 'ok' | |
end | |
it "should raise an error if db is not connecting" do | |
lambda { dispatch_to(Home, :app_status) }.should raise_error | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment