require 'rubygems' require 'gorp/test' class StutterRoutesTest < Gorp::TestCase test "Routes don't stutter" do desc 'Start with a new project' rails 'testapp' desc 'Generate a simple hello/goodbye world controller' ruby 'script/generate controller Say hello goodbye' desc 'Add the necessary routes' edit 'config/routes.rb' do gsub! /^\s+#.*/, '' gsub! /\n\n+/, "\n" msub /^()end/, <<-EOF.unindent(6) get 'say/hello' get 'say/goodbye' EOF end desc 'Very simple template... with a link' edit 'app/views/say/hello.html.erb' do self.all = <<-EOF.unindent(8) Hello Rails

Hello from Rails!

Time to say <%= link_to "Goodbye!", say_goodbye_path %>

EOF end desc 'Start the server' ruby 'script/server' get '/say/hello' do assert_select "a[href=http://localhost:#{$PORT}/say/goodbye]" end end end