Class: Riot::Situation
- Inherits:
-
Object
- Object
- Riot::Situation
- Includes:
- Rack::Test::Methods
- Defined in:
- lib/chicago/riot.rb
Instance Method Summary collapse
-
#app ⇒ Object
Allows Rack test methods to work in your Riot tests.
-
#mock_app(base = Sinatra::Base, &block) ⇒ Object
Sets up a Sinatra::Base subclass defined with the block given.
Instance Method Details
#app ⇒ Object
Allows Rack test methods to work in your Riot tests. Simply do this in your setup or test method:
context "MyApp" do
setup { @app = MyApp }
context "get /foo" do
setup { get "/foo" }
# ... tests ...
end
end
18 19 20 |
# File 'lib/chicago/riot.rb', line 18 def app @app end |
#mock_app(base = Sinatra::Base, &block) ⇒ Object
Sets up a Sinatra::Base subclass defined with the block given. Used in setup or individual test methods to define an application
context "get /foo" do
setup do
mock_app {
get("/foo") { stuff; status 200; }
}
get "/foo"
end
asserts_response_status 200
end
34 35 36 |
# File 'lib/chicago/riot.rb', line 34 def mock_app(base=Sinatra::Base, &block) @app = Sinatra.new(base, &block) end |