Module: Lookout::Rack::Test::RSpec
- Defined in:
- lib/lookout/rack/test/rspec.rb,
lib/lookout/rack/test/rspec.rb,
lib/lookout/rack/test/rspec/fake_request.rb,
lib/lookout/rack/test/rspec/route_helper.rb,
lib/lookout/rack/test/rspec/model_examples.rb
Defined Under Namespace
Modules: Models, RouteHelper Classes: FakeRequest
Instance Method Summary collapse
- #configure_rspec ⇒ Object
-
#setup_models(models) ⇒ Object
Takes one argument, the Models class (or module) that has a .setup and .unsetup method.
-
#setup_routes(application) ⇒ Object
Takes one argument, the application (e.g., SinatraApplication).
Instance Method Details
#configure_rspec ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/lookout/rack/test/rspec.rb', line 45 def configure_rspec ::RSpec.configure do |c| c.around(:each, :timefreeze => true) do |example| ::Timecop.freeze do example.run end end end end |
#setup_models(models) ⇒ Object
Takes one argument, the Models class (or module) that has a .setup and .unsetup method
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/lookout/rack/test/rspec.rb', line 20 def setup_models(models) ::RSpec.configure do |c| c.around(:each, :speed => :slow) do |example| models.setup example.run models.unsetup end c.before(:all, :speed => :slow) do require 'lookout/rack/test/load_factories' end end end |
#setup_routes(application) ⇒ Object
Takes one argument, the application (e.g., SinatraApplication)
35 36 37 38 39 40 41 42 43 |
# File 'lib/lookout/rack/test/rspec.rb', line 35 def setup_routes(application) ::RSpec.configure do |c| c.include(::Rack::Test::Methods, :type => :route) require 'lookout/rack/test/rspec/route_helper' ::Lookout::Rack::Test.app = application c.include(::RouteHelper, :type => :route) end end |