nifty-generators 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. data/CHANGELOG +11 -0
  2. data/README.rdoc +2 -2
  3. data/features/nifty_authentication.feature +2 -2
  4. data/features/nifty_scaffold.feature +15 -0
  5. data/features/step_definitions/common_steps.rb +1 -1
  6. data/features/step_definitions/rails_setup_steps.rb +1 -1
  7. data/lib/generators/nifty.rb +2 -2
  8. data/lib/generators/nifty/authentication/USAGE +15 -15
  9. data/lib/generators/nifty/authentication/authentication_generator.rb +10 -9
  10. data/lib/generators/nifty/authentication/templates/authentication.rb +9 -9
  11. data/lib/generators/nifty/authentication/templates/migration.rb +1 -1
  12. data/lib/generators/nifty/authentication/templates/sessions_controller.rb +4 -4
  13. data/lib/generators/nifty/authentication/templates/tests/rspec/sessions_controller.rb +6 -6
  14. data/lib/generators/nifty/authentication/templates/tests/rspec/user.rb +15 -15
  15. data/lib/generators/nifty/authentication/templates/tests/rspec/users_controller.rb +5 -5
  16. data/lib/generators/nifty/authentication/templates/tests/shoulda/sessions_controller.rb +3 -3
  17. data/lib/generators/nifty/authentication/templates/tests/shoulda/user.rb +15 -15
  18. data/lib/generators/nifty/authentication/templates/tests/shoulda/users_controller.rb +2 -2
  19. data/lib/generators/nifty/authentication/templates/tests/testunit/sessions_controller.rb +3 -3
  20. data/lib/generators/nifty/authentication/templates/tests/testunit/user.rb +15 -15
  21. data/lib/generators/nifty/authentication/templates/tests/testunit/users_controller.rb +2 -2
  22. data/lib/generators/nifty/authentication/templates/user.rb +7 -7
  23. data/lib/generators/nifty/authentication/templates/users_controller.rb +1 -1
  24. data/lib/generators/nifty/config/USAGE +2 -2
  25. data/lib/generators/nifty/config/config_generator.rb +3 -3
  26. data/lib/generators/nifty/layout/USAGE +2 -2
  27. data/lib/generators/nifty/layout/layout_generator.rb +4 -4
  28. data/lib/generators/nifty/layout/templates/error_messages_helper.rb +2 -2
  29. data/lib/generators/nifty/layout/templates/layout.html.erb +1 -1
  30. data/lib/generators/nifty/layout/templates/layout.html.haml +4 -4
  31. data/lib/generators/nifty/layout/templates/layout_helper.rb +3 -3
  32. data/lib/generators/nifty/layout/templates/stylesheet.sass +41 -41
  33. data/lib/generators/nifty/scaffold/USAGE +9 -9
  34. data/lib/generators/nifty/scaffold/scaffold_generator.rb +8 -6
  35. data/lib/generators/nifty/scaffold/templates/migration.rb +1 -1
  36. data/lib/generators/nifty/scaffold/templates/tests/rspec/actions/create.rb +1 -1
  37. data/lib/generators/nifty/scaffold/templates/tests/rspec/actions/update.rb +1 -1
  38. data/lib/generators/nifty/scaffold/templates/tests/rspec/controller.rb +3 -3
  39. data/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/create.rb +1 -1
  40. data/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/update.rb +1 -1
  41. data/lib/generators/nifty/scaffold/templates/tests/testunit/actions/create.rb +1 -1
  42. data/lib/generators/nifty/scaffold/templates/tests/testunit/actions/update.rb +1 -1
  43. data/rails_generators/nifty_authentication/USAGE +15 -15
  44. data/rails_generators/nifty_authentication/lib/insert_commands.rb +8 -8
  45. data/rails_generators/nifty_authentication/nifty_authentication_generator.rb +20 -20
  46. data/rails_generators/nifty_authentication/templates/authentication.rb +9 -9
  47. data/rails_generators/nifty_authentication/templates/migration.rb +1 -1
  48. data/rails_generators/nifty_authentication/templates/sessions_controller.rb +4 -4
  49. data/rails_generators/nifty_authentication/templates/tests/rspec/sessions_controller.rb +5 -5
  50. data/rails_generators/nifty_authentication/templates/tests/rspec/user.rb +15 -15
  51. data/rails_generators/nifty_authentication/templates/tests/rspec/users_controller.rb +4 -4
  52. data/rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb +3 -3
  53. data/rails_generators/nifty_authentication/templates/tests/shoulda/user.rb +15 -15
  54. data/rails_generators/nifty_authentication/templates/tests/shoulda/users_controller.rb +2 -2
  55. data/rails_generators/nifty_authentication/templates/tests/testunit/sessions_controller.rb +3 -3
  56. data/rails_generators/nifty_authentication/templates/tests/testunit/user.rb +15 -15
  57. data/rails_generators/nifty_authentication/templates/tests/testunit/users_controller.rb +2 -2
  58. data/rails_generators/nifty_authentication/templates/user.rb +7 -7
  59. data/rails_generators/nifty_authentication/templates/users_controller.rb +1 -1
  60. data/rails_generators/nifty_config/USAGE +2 -2
  61. data/rails_generators/nifty_config/nifty_config_generator.rb +3 -3
  62. data/rails_generators/nifty_layout/USAGE +2 -2
  63. data/rails_generators/nifty_layout/nifty_layout_generator.rb +3 -3
  64. data/rails_generators/nifty_layout/templates/helper.rb +3 -3
  65. data/rails_generators/nifty_layout/templates/layout.html.erb +2 -2
  66. data/rails_generators/nifty_layout/templates/layout.html.haml +4 -4
  67. data/rails_generators/nifty_scaffold/USAGE +9 -9
  68. data/rails_generators/nifty_scaffold/nifty_scaffold_generator.rb +38 -38
  69. data/rails_generators/nifty_scaffold/templates/migration.rb +1 -1
  70. data/rails_generators/nifty_scaffold/templates/tests/rspec/actions/create.rb +1 -1
  71. data/rails_generators/nifty_scaffold/templates/tests/rspec/actions/update.rb +1 -1
  72. data/rails_generators/nifty_scaffold/templates/tests/rspec/controller.rb +2 -2
  73. data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/create.rb +1 -1
  74. data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/update.rb +1 -1
  75. data/rails_generators/nifty_scaffold/templates/tests/testunit/actions/create.rb +1 -1
  76. data/rails_generators/nifty_scaffold/templates/tests/testunit/actions/update.rb +1 -1
  77. data/test/test_helper.rb +7 -7
  78. data/test/test_nifty_authentication_generator.rb +30 -30
  79. data/test/test_nifty_config_generator.rb +4 -4
  80. data/test/test_nifty_layout_generator.rb +5 -5
  81. data/test/test_nifty_scaffold_generator.rb +93 -93
  82. metadata +6 -4
data/CHANGELOG CHANGED
@@ -1,3 +1,14 @@
1
+ 0.4.1 (September 23rd, 2010)
2
+
3
+ * fixing frozen hash error when not passing additional arguments to nifty:scaffold - issue #35
4
+
5
+ * fixing rendering of default title in nifty:layout - issue #36
6
+
7
+ * fixing integrate_views error in nifty:scaffold specs - issue #43
8
+
9
+ * updating SASS syntax (thanks semaperepelitsa) - issue #46
10
+
11
+
1
12
  0.4.0 (April 19th, 2010)
2
13
 
3
14
  * adding error_messages_for and f.error_messages helper for Rails 3 nifty:layout
@@ -87,10 +87,10 @@ Try restarting your development server. Sometimes it doesn't detect the change i
87
87
  Make sure you have mocha installed and require it in your spec/test helper.
88
88
 
89
89
  gem install mocha
90
-
90
+
91
91
  # in spec_helper.rb
92
92
  config.mock_with :mocha
93
-
93
+
94
94
  # in test_helper.rb
95
95
  require 'mocha'
96
96
 
@@ -2,7 +2,7 @@ Feature: Nifty Authentication Generator
2
2
  In order to authenticate users
3
3
  As a rails developer
4
4
  I want to generate some user authentication
5
-
5
+
6
6
  Scenario: Generate default authentication
7
7
  Given a new Rails app
8
8
  When I run "rails g nifty:authentication"
@@ -31,7 +31,7 @@ Feature: Nifty Authentication Generator
31
31
  And I run "rake db:migrate"
32
32
  And I add "gem 'mocha', :group => :test" to file "Gemfile"
33
33
  Then I should successfully run "rake test"
34
-
34
+
35
35
  Scenario: Generate named authentication
36
36
  Given a new Rails app
37
37
  When I run "rails g nifty:authentication Account CurrentSession"
@@ -18,5 +18,20 @@ Feature: Nifty Scaffold Generator
18
18
  And I should see "resources :projects" in file "config/routes.rb"
19
19
  When I run "rails g nifty:layout -f"
20
20
  And I run "rake db:migrate"
21
+ And I should successfully run "rails g nifty:scaffold Project -f"
21
22
  And I add "gem 'mocha', :group => :test" to file "Gemfile"
22
23
  Then I should successfully run "rake test"
24
+
25
+ Scenario: Generate scaffold with rspec tests
26
+ Given a new Rails app
27
+ When I run "rails g nifty:scaffold Project name:string --rspec"
28
+ Then I should see the following files
29
+ | spec/models/project_spec.rb |
30
+ | spec/controllers/projects_controller_spec.rb |
31
+ And I should see "resources :projects" in file "config/routes.rb"
32
+ When I run "rails g nifty:layout -f"
33
+ And I run "rake db:migrate"
34
+ And I add "gem 'mocha', :group => :test" to file "Gemfile"
35
+ And I add "gem 'rspec-rails', '>= 2.0.0.beta.19'" to file "Gemfile"
36
+ And I run "rails g rspec:install"
37
+ Then I should successfully run "rake spec"
@@ -5,7 +5,7 @@ end
5
5
  When /^I add "([^\"]*)" to file "([^\"]*)"$/ do |content, short_path|
6
6
  path = File.join(@current_directory, short_path)
7
7
  File.should exist(path)
8
- File.open(path, 'a') { |f| f.write(content) }
8
+ File.open(path, 'a') { |f| f.write(content + "\n") }
9
9
  end
10
10
 
11
11
  Then /^I should see file "([^\"]*)"$/ do |path|
@@ -1,6 +1,6 @@
1
1
  Given /^a new Rails app$/ do
2
2
  FileUtils.mkdir_p("tmp")
3
- system("rails tmp/rails_app").should be_true
3
+ system("rails new tmp/rails_app").should be_true
4
4
  system("ln -s ../../../lib/generators tmp/rails_app/lib/generators").should be_true
5
5
  @current_directory = File.expand_path("tmp/rails_app")
6
6
  end
@@ -1,12 +1,12 @@
1
1
  require 'rails/generators/base'
2
-
2
+
3
3
  module Nifty
4
4
  module Generators
5
5
  class Base < Rails::Generators::Base #:nodoc:
6
6
  def self.source_root
7
7
  @_nifty_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'nifty', generator_name, 'templates'))
8
8
  end
9
-
9
+
10
10
  def self.banner
11
11
  "#{$0} nifty:#{generator_name} #{self.arguments.map{ |a| a.usage }.join(' ')} [options]"
12
12
  end
@@ -1,9 +1,9 @@
1
1
  Description:
2
- Generates a user model, users controller, and sessions controller. The
3
- users controller handles the registration and the sessions controller
4
- handles authentication. This is similar to restful_authentication, but
2
+ Generates a user model, users controller, and sessions controller. The
3
+ users controller handles the registration and the sessions controller
4
+ handles authentication. This is similar to restful_authentication, but
5
5
  simpler.
6
-
6
+
7
7
  IMPORTANT: This generator uses the "title" helper method which is generated
8
8
  by the nifty_layout generator. You may want to run that generator first.
9
9
 
@@ -12,28 +12,28 @@ Usage:
12
12
  the authentication controller will default to "session". You can override
13
13
  each of these respectively by passing one or two arguments. Either name can
14
14
  be CamelCased or under_scored.
15
-
15
+
16
16
  Make sure to setup the authlogic gem if you are using that option.
17
-
17
+
18
18
  gem "authlogic" # in Gemfile
19
19
 
20
20
  Examples:
21
21
  rails generate nifty:authentication
22
-
22
+
23
23
  Creates user model, users_controller, and sessions_controller.
24
-
24
+
25
25
  rails generate nifty:authentication account
26
-
26
+
27
27
  Creates account model, accounts_controller, and sessions_controller.
28
-
28
+
29
29
  rails generate nifty:authentication Account UserSession
30
-
30
+
31
31
  Creates account model, accounts_controller, and user_sessions_controller.
32
32
 
33
33
  Methods:
34
34
  There are several methods generated which you can use in your application.
35
35
  Here's a common example of what you might add to your layout.
36
-
36
+
37
37
  <% if logged_in? %>
38
38
  Welcome <%= current_user.username %>! Not you?
39
39
  <%= link_to "Log out", logout_path %>
@@ -41,10 +41,10 @@ Methods:
41
41
  <%= link_to "Sign up", signup_path %> or
42
42
  <%= link_to "log in", login_path %>.
43
43
  <% end %>
44
-
44
+
45
45
  You can also restrict unregistered users from accessing a controller using
46
46
  a before filter. For example.
47
-
47
+
48
48
  before_filter :login_required, :except => [:index, :show]
49
-
49
+
50
50
  See the generated file lib/authentication.rb for details.
@@ -5,17 +5,17 @@ module Nifty
5
5
  module Generators
6
6
  class AuthenticationGenerator < Base
7
7
  include Rails::Generators::Migration
8
-
8
+
9
9
  argument :user_name, :type => :string, :default => 'user', :banner => 'user_name'
10
10
  argument :session_name, :type => :string, :default => '[[DEFAULT]]', :banner => 'sessions_controller_name'
11
-
11
+
12
12
  class_option :testunit, :desc => 'Use test/unit for test files.', :group => 'Test framework', :type => :boolean
13
13
  class_option :rspec, :desc => 'Use RSpec for test files.', :group => 'Test framework', :type => :boolean
14
14
  class_option :shoulda, :desc => 'Use shoulda for test files.', :group => 'Test framework', :type => :boolean
15
-
15
+
16
16
  class_option :haml, :desc => 'Generate HAML views instead of ERB.', :type => :boolean
17
17
  class_option :authlogic, :desc => 'Use Authlogic for authentication.', :type => :boolean
18
-
18
+
19
19
  def create_model_files
20
20
  template 'user.rb', "app/models/#{user_singular_name}.rb"
21
21
  template 'authlogic_session.rb', "app/models/#{user_singular_name}_session.rb" if options.authlogic?
@@ -26,7 +26,7 @@ module Nifty
26
26
  template 'sessions_controller.rb', "app/controllers/#{session_plural_name}_controller.rb"
27
27
  end
28
28
 
29
- def crete_helper_files
29
+ def create_helper_files
30
30
  template 'users_helper.rb', "app/helpers/#{user_plural_name}_helper.rb"
31
31
  template 'sessions_helper.rb', "app/helpers/#{session_plural_name}_helper.rb"
32
32
  end
@@ -47,12 +47,13 @@ module Nifty
47
47
  route "match 'logout' => '#{session_plural_name}#destroy', :as => :logout"
48
48
  route "match 'signup' => '#{user_plural_name}#new', :as => :signup"
49
49
  end
50
-
50
+
51
51
  def create_migration
52
52
  migration_template 'migration.rb', "db/migrate/create_#{user_plural_name}.rb"
53
53
  end
54
-
55
- def create_include_line
54
+
55
+ def load_and_include_authentication
56
+ inject_into_class "config/application.rb", "Application", " config.autoload_paths << \"\#{config.root}/lib\""
56
57
  inject_into_class "app/controllers/application_controller.rb", "ApplicationController", " include Authentication\n"
57
58
  end
58
59
 
@@ -71,7 +72,7 @@ module Nifty
71
72
  end
72
73
 
73
74
  private
74
-
75
+
75
76
  def session_name
76
77
  @_session_name ||= @session_name == '[[DEFAULT]]' ?
77
78
  (options.authlogic? ? user_name + '_session' : 'session') :
@@ -1,7 +1,7 @@
1
1
  # This module is included in your application controller which makes
2
2
  # several methods available to all controllers and views. Here's a
3
3
  # common example you might add to your application layout file.
4
- #
4
+ #
5
5
  # <%% if logged_in? %>
6
6
  # Welcome <%%= current_<%= user_singular_name %>.username %>! Not you?
7
7
  # <%%= link_to "Log out", logout_path %>
@@ -9,16 +9,16 @@
9
9
  # <%%= link_to "Sign up", signup_path %> or
10
10
  # <%%= link_to "log in", login_path %>.
11
11
  # <%% end %>
12
- #
12
+ #
13
13
  # You can also restrict unregistered users from accessing a controller using
14
14
  # a before filter. For example.
15
- #
15
+ #
16
16
  # before_filter :login_required, :except => [:index, :show]
17
17
  module Authentication
18
18
  def self.included(controller)
19
19
  controller.send :helper_method, :current_<%= user_singular_name %>, :logged_in?, :redirect_to_target_or_default
20
20
  end
21
-
21
+
22
22
  <%- if options[:authlogic] -%>
23
23
  def current_<%= session_singular_name %>
24
24
  return @current_<%= session_singular_name %> if defined?(@current_<%= session_singular_name %>)
@@ -34,11 +34,11 @@ module Authentication
34
34
  @current_<%= user_singular_name %> ||= <%= user_class_name %>.find(session[:<%= user_singular_name %>_id]) if session[:<%= user_singular_name %>_id]
35
35
  end
36
36
  <%- end -%>
37
-
37
+
38
38
  def logged_in?
39
39
  current_<%= user_singular_name %>
40
40
  end
41
-
41
+
42
42
  def login_required
43
43
  unless logged_in?
44
44
  flash[:error] = "You must first log in or sign up before accessing this page."
@@ -46,14 +46,14 @@ module Authentication
46
46
  redirect_to login_url
47
47
  end
48
48
  end
49
-
49
+
50
50
  def redirect_to_target_or_default(default)
51
51
  redirect_to(session[:return_to] || default)
52
52
  session[:return_to] = nil
53
53
  end
54
-
54
+
55
55
  private
56
-
56
+
57
57
  def store_target_location
58
58
  session[:return_to] = request.request_uri
59
59
  end
@@ -13,7 +13,7 @@ class Create<%= user_plural_class_name %> < ActiveRecord::Migration
13
13
  t.timestamps
14
14
  end
15
15
  end
16
-
16
+
17
17
  def self.down
18
18
  drop_table :<%= user_plural_name %>
19
19
  end
@@ -3,7 +3,7 @@ class <%= session_plural_class_name %>Controller < ApplicationController
3
3
  def new
4
4
  @<%= session_singular_name %> = <%= session_class_name %>.new
5
5
  end
6
-
6
+
7
7
  def create
8
8
  @<%= session_singular_name %> = <%= session_class_name %>.new(params[:<%= session_singular_name %>])
9
9
  if @<%= session_singular_name %>.save
@@ -13,7 +13,7 @@ class <%= session_plural_class_name %>Controller < ApplicationController
13
13
  render :action => 'new'
14
14
  end
15
15
  end
16
-
16
+
17
17
  def destroy
18
18
  @<%= session_singular_name %> = <%= session_class_name %>.find
19
19
  @<%= session_singular_name %>.destroy
@@ -23,7 +23,7 @@ class <%= session_plural_class_name %>Controller < ApplicationController
23
23
  <%- else -%>
24
24
  def new
25
25
  end
26
-
26
+
27
27
  def create
28
28
  <%= user_singular_name %> = <%= user_class_name %>.authenticate(params[:login], params[:password])
29
29
  if <%= user_singular_name %>
@@ -35,7 +35,7 @@ class <%= session_plural_class_name %>Controller < ApplicationController
35
35
  render :action => 'new'
36
36
  end
37
37
  end
38
-
38
+
39
39
  def destroy
40
40
  session[:<%= user_singular_name %>_id] = nil
41
41
  flash[:notice] = "You have been logged out."
@@ -1,21 +1,21 @@
1
1
  require File.dirname(__FILE__) + '/../spec_helper'
2
-
2
+
3
3
  describe <%= session_plural_class_name %>Controller do
4
4
  fixtures :all
5
- integrate_views
6
-
5
+ render_views
6
+
7
7
  it "new action should render new template" do
8
8
  get :new
9
9
  response.should render_template(:new)
10
10
  end
11
-
11
+
12
12
  <%- if options[:authlogic] -%>
13
13
  it "create action should render new template when authentication is invalid" do
14
14
  post :create, :<%= session_singular_name %> => { :username => "foo", :password => "badpassword" }
15
15
  response.should render_template(:new)
16
16
  <%= session_class_name %>.find.should be_nil
17
17
  end
18
-
18
+
19
19
  it "create action should redirect when authentication is valid" do
20
20
  post :create, :<%= session_singular_name %> => { :username => "foo", :password => "secret" }
21
21
  response.should redirect_to("/")
@@ -28,7 +28,7 @@ describe <%= session_plural_class_name %>Controller do
28
28
  response.should render_template(:new)
29
29
  session['<%= user_singular_name %>_id'].should be_nil
30
30
  end
31
-
31
+
32
32
  it "create action should redirect when authentication is valid" do
33
33
  <%= user_class_name %>.stubs(:authenticate).returns(<%= user_class_name %>.first)
34
34
  post :create
@@ -9,72 +9,72 @@ describe <%= user_class_name %> do
9
9
  attributes[:password_confirmation] ||= attributes[:password]
10
10
  <%= user_class_name %>.new(attributes)
11
11
  end
12
-
12
+
13
13
  before(:each) do
14
14
  <%= user_class_name %>.delete_all
15
15
  end
16
-
16
+
17
17
  it "should be valid" do
18
18
  new_<%= user_singular_name %>.should be_valid
19
19
  end
20
-
20
+
21
21
  it "should require username" do
22
22
  new_<%= user_singular_name %>(:username => '').should have(1).error_on(:username)
23
23
  end
24
-
24
+
25
25
  it "should require password" do
26
26
  new_<%= user_singular_name %>(:password => '').should have(1).error_on(:password)
27
27
  end
28
-
28
+
29
29
  it "should require well formed email" do
30
30
  new_<%= user_singular_name %>(:email => 'foo@bar@example.com').should have(1).error_on(:email)
31
31
  end
32
-
32
+
33
33
  it "should validate uniqueness of email" do
34
34
  new_<%= user_singular_name %>(:email => 'bar@example.com').save!
35
35
  new_<%= user_singular_name %>(:email => 'bar@example.com').should have(1).error_on(:email)
36
36
  end
37
-
37
+
38
38
  it "should validate uniqueness of username" do
39
39
  new_<%= user_singular_name %>(:username => 'uniquename').save!
40
40
  new_<%= user_singular_name %>(:username => 'uniquename').should have(1).error_on(:username)
41
41
  end
42
-
42
+
43
43
  it "should not allow odd characters in username" do
44
44
  new_<%= user_singular_name %>(:username => 'odd ^&(@)').should have(1).error_on(:username)
45
45
  end
46
-
46
+
47
47
  it "should validate password is longer than 3 characters" do
48
48
  new_<%= user_singular_name %>(:password => 'bad').should have(1).error_on(:password)
49
49
  end
50
-
50
+
51
51
  it "should require matching password confirmation" do
52
52
  new_<%= user_singular_name %>(:password_confirmation => 'nonmatching').should have(1).error_on(:password)
53
53
  end
54
-
54
+
55
55
  it "should generate password hash and salt on create" do
56
56
  <%= user_singular_name %> = new_<%= user_singular_name %>
57
57
  <%= user_singular_name %>.save!
58
58
  <%= user_singular_name %>.password_hash.should_not be_nil
59
59
  <%= user_singular_name %>.password_salt.should_not be_nil
60
60
  end
61
-
61
+
62
62
  it "should authenticate by username" do
63
63
  <%= user_singular_name %> = new_<%= user_singular_name %>(:username => 'foobar', :password => 'secret')
64
64
  <%= user_singular_name %>.save!
65
65
  <%= user_class_name %>.authenticate('foobar', 'secret').should == <%= user_singular_name %>
66
66
  end
67
-
67
+
68
68
  it "should authenticate by email" do
69
69
  <%= user_singular_name %> = new_<%= user_singular_name %>(:email => 'foo@bar.com', :password => 'secret')
70
70
  <%= user_singular_name %>.save!
71
71
  <%= user_class_name %>.authenticate('foo@bar.com', 'secret').should == <%= user_singular_name %>
72
72
  end
73
-
73
+
74
74
  it "should not authenticate bad username" do
75
75
  <%= user_class_name %>.authenticate('nonexisting', 'secret').should be_nil
76
76
  end
77
-
77
+
78
78
  it "should not authenticate bad password" do
79
79
  new_<%= user_singular_name %>(:username => 'foobar', :password => 'secret').save!
80
80
  <%= user_class_name %>.authenticate('foobar', 'badpassword').should be_nil