If you move most of the application client side, you could use something like jsdom to test it. That's obviously not going to get you the same level of confidence that a full stack test in a real browser would though. Maybe a combination of the two?
Blah = {
:foo => proc { puts "foo" },
:bar => proc { puts "bar" },
:baz => proc { puts "baz" }
}
def Monkey(method)
klass = Class.new
klass.class_eval do
define_method :shout do
Blah[method].call
end
end
return klass
end
class Chimp < Monkey(:foo)
end
class Gorilla < Monkey(:bar)
end
a = Chimp.new
a.shout # => "foo"
b = Gorilla.new
b.shout # => "bar"
Blah[:foo] = proc { puts "I have changed" }
a.shout # => "I have changed"