Skip to content

Instantly share code, notes, and snippets.

@jackdempsey
Created September 25, 2008 17:11
Show Gist options
  • Save jackdempsey/12863 to your computer and use it in GitHub Desktop.
Save jackdempsey/12863 to your computer and use it in GitHub Desktop.
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