Skip to content

Commit

Permalink
Controller generators should generate tests when action is supplied. [#…
Browse files Browse the repository at this point in the history
…3421 state:resolved]
  • Loading branch information
rubys authored and josevalim committed Mar 19, 2010
1 parent 525382f commit 80095c5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Expand Up @@ -3,6 +3,7 @@
module TestUnit
module Generators
class ControllerGenerator < Base
argument :actions, :type => :array, :default => [], :banner => "action action"
check_class_collision :suffix => "ControllerTest"

def create_test_files
Expand Down
@@ -1,8 +1,18 @@
require 'test_helper'

class <%= class_name %>ControllerTest < ActionController::TestCase
<% if actions.empty? -%>
# Replace this with your real tests.
test "the truth" do
assert true
end
<% else -%>
<% for action in actions -%>
test "should get <%= action %>" do
get :<%= action %>
assert_response :success
end
<% end -%>
<% end -%>
end

0 comments on commit 80095c5

Please sign in to comment.