Skip to content

Commit

Permalink
Merging from crnixon: updated to use Rails 2 test cases (0efec8a), fi…
Browse files Browse the repository at this point in the history
…xed pluralization mistake in README (892c4f7), replaced <label> HTML with label_tag helpers (77995d9)
  • Loading branch information
Philip (flip) Kromer committed Aug 7, 2008
2 parents f54b095 + 77995d9 commit 3494101
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README
Expand Up @@ -158,7 +158,7 @@ alter to suit. There are additional security minutae in @notes/README-Tradeoffs@

and add an observer to @config/environment.rb@:

config.active_record.observers = :users_observer
config.active_record.observers = :user_observer

* With @--stateful@, add an observer to config/environment.rb:

Expand Down
6 changes: 3 additions & 3 deletions generators/authenticated/templates/login.html.erb
@@ -1,14 +1,14 @@
<h1>Log In</h1>

<%% form_tag <%= controller_routing_name %>_path do -%>
<p><label for="login">Login</label><br/>
<p><%%= label_tag 'login' %><br />
<%%= text_field_tag 'login', @login %></p>

<p><label for="password">Password</label><br/>
<p><%%= label_tag 'password' %><br/>
<%%= password_field_tag 'password', nil %></p>

<!-- Uncomment this if you want this functionality
<p><label for="remember_me">Remember me:</label>
<p><%%= label_tag 'remember_me', 'Remember me' %>
<%%= check_box_tag 'remember_me', '1', @remember_me %></p>
-->

Expand Down
8 changes: 4 additions & 4 deletions generators/authenticated/templates/signup.html.erb
Expand Up @@ -3,16 +3,16 @@

<%%= error_messages_for :<%= file_name %> %>
<%% form_for :<%= file_name %>, :url => <%= model_controller_routing_name %>_path do |f| -%>
<p><label for="login">Login</label><br/>
<p><%%= label_tag 'login' %><br/>
<%%= f.text_field :login %></p>

<p><label for="email">Email</label><br/>
<p><%%= label_tag 'email' %><br/>
<%%= f.text_field :email %></p>

<p><label for="password">Password</label><br/>
<p><%%= label_tag 'password' %><br/>
<%%= f.password_field :password %></p>

<p><label for="password_confirmation">Confirm Password</label><br/>
<p><%%= label_tag 'password_confirmation', 'Confirm Password' %><br/>
<%%= f.password_field :password_confirmation %></p>

<p><%%= submit_tag 'Sign up' %></p>
Expand Down
8 changes: 1 addition & 7 deletions generators/authenticated/templates/test/functional_test.rb
Expand Up @@ -4,19 +4,13 @@
# Re-raise errors caught by the controller.
class <%= controller_class_name %>Controller; def rescue_action(e) raise e end; end
class <%= controller_class_name %>ControllerTest < Test::Unit::TestCase
class <%= controller_class_name %>ControllerTest < ActionController::TestCase
# Be sure to include AuthenticatedTestHelper in test/test_helper.rb instead
# Then, you can remove it from this and the units test.
include AuthenticatedTestHelper

fixtures :<%= table_name %>

def setup
@controller = <%= controller_class_name %>Controller.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
end
def test_should_login_and_redirect
post :create, :login => 'quentin', :password => 'monkey'
assert session[:<%= file_name %>_id]
Expand Down
Expand Up @@ -4,19 +4,13 @@
# Re-raise errors caught by the controller.
class <%= model_controller_class_name %>Controller; def rescue_action(e) raise e end; end
class <%= model_controller_class_name %>ControllerTest < Test::Unit::TestCase
class <%= model_controller_class_name %>ControllerTest < ActionController::TestCase
# Be sure to include AuthenticatedTestHelper in test/test_helper.rb instead
# Then, you can remove it from this and the units test.
include AuthenticatedTestHelper

fixtures :<%= table_name %>

def setup
@controller = <%= model_controller_class_name %>Controller.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
end
def test_should_allow_signup
assert_difference '<%= class_name %>.count' do
create_<%= file_name %>
Expand Down
2 changes: 1 addition & 1 deletion generators/authenticated/templates/test/unit_test.rb
@@ -1,6 +1,6 @@
require File.dirname(__FILE__) + '/../test_helper'

class <%= class_name %>Test < Test::Unit::TestCase
class <%= class_name %>Test < ActiveSupport::TestCase
# Be sure to include AuthenticatedTestHelper in test/test_helper.rb instead.
# Then, you can remove it from this and the functional test.
include AuthenticatedTestHelper
Expand Down

0 comments on commit 3494101

Please sign in to comment.