Sha256: c303bb7c7d003fdbb33da7b84acb2cfd3e462b36ed554b125d149140b36adb75
Contents?: true
Size: 1.39 KB
Versions: 5
Compression:
Stored size: 1.39 KB
Contents
# Sets up use_route across controller tests, from: # http://bit.ly/PU4Wm4 (stackoverflow) module ControllerSetup def get(action, parameters = nil, session = nil, flash = nil) process_action(action, parameters, session, flash, "GET") end # Executes a request simulating POST HTTP method and set/volley the # response def post(action, parameters = nil, session = nil, flash = nil) process_action(action, parameters, session, flash, "POST") end # Executes a request simulating PUT HTTP method and set/volley the # response def put(action, parameters = nil, session = nil, flash = nil) process_action(action, parameters, session, flash, "PUT") end # Executes a request simulating DELETE HTTP method and set/volley # the response def delete(action, parameters = nil, session = nil, flash = nil) process_action(action, parameters, session, flash, "DELETE") end private def process_action(action, parameters = nil, session = nil, flash = nil, method = "GET") parameters ||= {} process(action, parameters.merge!(:use_route => :tim), session, flash, method) end end RSpec.configure do |c| # This will include the routing helpers in the specs so that we can # use base_image_path and so on to get to the routes. c.include Tim::Engine.routes.url_helpers # Always use the correct route for controller tests c.include ControllerSetup, :type => :controller end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
tim-0.3.0 | spec/support/routes.rb |
tim-0.2.0 | spec/support/routes.rb |
tim-0.1.2 | spec/support/routes.rb |
tim-0.1.1 | spec/support/routes.rb |
tim-0.0.1 | spec/support/routes.rb |