Skip to content

Instantly share code, notes, and snippets.

@rondale-sc
Created February 8, 2013 19:23
Show Gist options
  • Save rondale-sc/4741289 to your computer and use it in GitHub Desktop.
Save rondale-sc/4741289 to your computer and use it in GitHub Desktop.
class CreateRouteTests
def initialize(routes_file)
self.routes = File.read(routes_file).split("\n")
end
def parsed_routes
self.parsed_routes = routes.map {|r| Hash[[:method, :url, :action].zip(r.split(" "))] }
end
def create_it_blocks
parsed_routes.collect do |route|
"it { #{route[:method]}(#{route[:url]}).should route_to(#{route[:action]}) }"
end
end
private
attr_accessor :routes, :it_blocks
attr_writer :parsed_routes
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment