From 2219ab62d342efbda60458161afaed5e3f1b4983 Mon Sep 17 00:00:00 2001 From: "mike.gaffney" Date: Mon, 1 Jun 2009 12:25:36 -0500 Subject: [PATCH] refactoring buttons to their own controller --- .../rails/app/controllers/buttons_controller.rb | 7 +++++++ .../rails/app/controllers/webrat_controller.rb | 3 --- spec/integration/rails/app/helpers/buttons_helper.rb | 2 ++ .../integration/rails/app/views/buttons/show.html.erb | 11 +++++++++++ spec/integration/rails/config/routes.rb | 4 ++-- .../rails/test/functional/buttons_controller_test.rb | 8 ++++++++ 6 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 spec/integration/rails/app/controllers/buttons_controller.rb create mode 100644 spec/integration/rails/app/helpers/buttons_helper.rb create mode 100644 spec/integration/rails/app/views/buttons/show.html.erb create mode 100644 spec/integration/rails/test/functional/buttons_controller_test.rb diff --git a/spec/integration/rails/app/controllers/buttons_controller.rb b/spec/integration/rails/app/controllers/buttons_controller.rb new file mode 100644 index 0000000..c549d1f --- /dev/null +++ b/spec/integration/rails/app/controllers/buttons_controller.rb @@ -0,0 +1,7 @@ +class ButtonsController < ApplicationController + def show + end + def create + render :text => "success" + end +end diff --git a/spec/integration/rails/app/controllers/webrat_controller.rb b/spec/integration/rails/app/controllers/webrat_controller.rb index 2861d2e..d754ca7 100644 --- a/spec/integration/rails/app/controllers/webrat_controller.rb +++ b/spec/integration/rails/app/controllers/webrat_controller.rb @@ -9,9 +9,6 @@ class WebratController < ApplicationController def form end - def buttons - end - def submit render :text => "OK Test Link Text" end diff --git a/spec/integration/rails/app/helpers/buttons_helper.rb b/spec/integration/rails/app/helpers/buttons_helper.rb new file mode 100644 index 0000000..d8fa3c2 --- /dev/null +++ b/spec/integration/rails/app/helpers/buttons_helper.rb @@ -0,0 +1,2 @@ +module ButtonsHelper +end diff --git a/spec/integration/rails/app/views/buttons/show.html.erb b/spec/integration/rails/app/views/buttons/show.html.erb new file mode 100644 index 0000000..7375623 --- /dev/null +++ b/spec/integration/rails/app/views/buttons/show.html.erb @@ -0,0 +1,11 @@ +

Webrat Buttons Form

+ +<% form_tag "/buttons" do %> + + + + + + + +<% end %> \ No newline at end of file diff --git a/spec/integration/rails/config/routes.rb b/spec/integration/rails/config/routes.rb index f3a66e6..f08763b 100644 --- a/spec/integration/rails/config/routes.rb +++ b/spec/integration/rails/config/routes.rb @@ -1,4 +1,6 @@ ActionController::Routing::Routes.draw do |map| + map.resource 'links', :only => [:show] + map.resource 'buttons', :only => [:show, :create] map.with_options :controller => "webrat" do |webrat| webrat.submit "/submit", :action => "submit" webrat.internal_redirect "/internal_redirect", :action => "internal_redirect" @@ -9,8 +11,6 @@ ActionController::Routing::Routes.draw do |map| webrat.redirect_to_show_params "/redirect_to_show_params", :action => "redirect_to_show_params" webrat.show_params "/show_params", :action => "show_params" - webrat.buttons "/buttons", :action => "buttons" webrat.root :action => "form" end - map.resource 'links' end diff --git a/spec/integration/rails/test/functional/buttons_controller_test.rb b/spec/integration/rails/test/functional/buttons_controller_test.rb new file mode 100644 index 0000000..e61daec --- /dev/null +++ b/spec/integration/rails/test/functional/buttons_controller_test.rb @@ -0,0 +1,8 @@ +require 'test_helper' + +class ButtonsControllerTest < ActionController::TestCase + # Replace this with your real tests. + test "the truth" do + assert true + end +end