Skip to content

Instantly share code, notes, and snippets.

foo = {}
basenames = ActionController::Routing::Routes.named_routes.routes.keys
basenames.each {|name| foo[name] = false}
Dir.glob(File.join(RAILS_ROOT, '/app', '**', '*.rb')).each do |file|
data = File.read(file)
basenames.each do |basename|
reg = Regexp.new(basename.to_s+"_(?=url|path)")
if reg.match data
foo[basename] = true
end
missing_actions = []
ActionController::Routing::Routes.routes.each do |route|
begin
unless "#{route.defaults[:controller]}_controller".classify.constantize.instance_methods.include? route.defaults[:action]
missing_actions << route.defaults
end
rescue
end
end
controllers = ActionController::Routing::Routes.routes.collect {|r| "#{r.defaults[:controller]}_controller".classify}
non_existent = []
controllers.uniq.each do |c|
begin
c.constantize
rescue
non_existent << c
end
end
def change_play_game
@game = Game.find(params[:game_id])
respond_to do |format|
format.js do
render(:update) do |page|
page[:game_display].replace_html(:partial => '/students/display_for_play', :locals => {:game => @game})
end
end
end
end
Scenario: Visit the local conditions page for a location where conditions are available
Given I have a demonstration site
And the web service knows about "Sydney, NSW"
When I visit "/weather/local-conditions/nsw/sydney"
Then I should see "Sydney current conditions"
And I should see a "Dew point" value of "14"
@slowjud
slowjud / string.rb
Created February 26, 2009 02:12 — forked from chrislloyd/string.rb
require 'singleton'
class String
class TextHelperSingleton
include Singleton
include ActionView::Helpers::TextHelper
end
def method_missing(method, *args)