raygun 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +3 -3
- data/.rbenv-version +1 -1
- data/README.md +2 -9
- data/Rakefile +1 -1
- data/TODO.md +0 -5
- data/app_prototype/.gitignore +15 -0
- data/app_prototype/.rspec +1 -0
- data/app_prototype/.rvmrc +1 -0
- data/{templates/Gemfile_customized → app_prototype/Gemfile} +1 -0
- data/{templates/Guardfile_customized → app_prototype/Guardfile} +6 -0
- data/{templates → app_prototype}/Procfile +0 -0
- data/{templates/README.md.erb → app_prototype/README.md} +0 -0
- data/app_prototype/Rakefile +10 -0
- data/app_prototype/app/assets/javascripts/application.js +16 -0
- data/app_prototype/app/assets/javascripts/users.js.coffee +3 -0
- data/{templates/_app → app_prototype/app}/assets/stylesheets/_footer.less +0 -0
- data/{templates/_app → app_prototype/app}/assets/stylesheets/application.css.less +0 -0
- data/{templates/_app → app_prototype/app}/controllers/application_controller.rb +1 -0
- data/{templates/_app → app_prototype/app}/controllers/password_resets_controller.rb +0 -0
- data/{templates/_app → app_prototype/app}/controllers/registrations_controller.rb +2 -0
- data/{templates/_app → app_prototype/app}/controllers/user_sessions_controller.rb +1 -1
- data/app_prototype/app/controllers/users_controller.rb +41 -0
- data/{templates/_app → app_prototype/app}/helpers/application_helper.rb +0 -0
- data/app_prototype/app/helpers/users_helper.rb +2 -0
- data/app_prototype/app/mailers/.gitkeep +0 -0
- data/{templates/_app → app_prototype/app}/mailers/user_mailer.rb +0 -0
- data/app_prototype/app/models/.gitkeep +0 -0
- data/{templates/_app → app_prototype/app}/models/ability.rb +0 -0
- data/{templates/_app → app_prototype/app}/models/user.rb +0 -0
- data/{templates/_app → app_prototype/app}/models/user_session.rb +0 -0
- data/{templates/_app/views/layouts/application.html.slim.erb → app_prototype/app/views/layouts/application.html.slim} +2 -2
- data/{templates/_app → app_prototype/app}/views/password_resets/edit.html.slim +0 -0
- data/{templates/_app → app_prototype/app}/views/password_resets/new.html.slim +0 -0
- data/{templates/_app → app_prototype/app}/views/registrations/new.html.slim +0 -0
- data/{templates/_app → app_prototype/app}/views/user_mailer/activation_needed_email.html.erb +0 -0
- data/{templates/_app → app_prototype/app}/views/user_mailer/activation_needed_email.text.erb +0 -0
- data/{templates/_app → app_prototype/app}/views/user_mailer/activation_success_email.html.erb +0 -0
- data/{templates/_app → app_prototype/app}/views/user_mailer/activation_success_email.text.erb +0 -0
- data/{templates/_app → app_prototype/app}/views/user_mailer/reset_password_email.html.erb +0 -0
- data/{templates/_app → app_prototype/app}/views/user_mailer/reset_password_email.text.erb +0 -0
- data/{templates/_app → app_prototype/app}/views/user_sessions/new.html.slim +0 -0
- data/app_prototype/app/views/users/_form.html.slim +12 -0
- data/app_prototype/app/views/users/edit.html.slim +5 -0
- data/app_prototype/app/views/users/index.html.slim +26 -0
- data/app_prototype/app/views/users/new.html.slim +4 -0
- data/app_prototype/app/views/users/show.html.slim +17 -0
- data/app_prototype/config.ru +8 -0
- data/app_prototype/config/application.rb +77 -0
- data/app_prototype/config/boot.rb +6 -0
- data/{templates/_config/database.yml.erb → app_prototype/config/database.yml} +2 -2
- data/app_prototype/config/environment.rb +5 -0
- data/app_prototype/config/environments/acceptance.rb +69 -0
- data/app_prototype/config/environments/development.rb +39 -0
- data/app_prototype/config/environments/production.rb +69 -0
- data/app_prototype/config/environments/test.rb +40 -0
- data/app_prototype/config/initializers/backtrace_silencers.rb +7 -0
- data/app_prototype/config/initializers/inflections.rb +15 -0
- data/app_prototype/config/initializers/mime_types.rb +5 -0
- data/app_prototype/config/initializers/secret_token.rb +7 -0
- data/app_prototype/config/initializers/session_store.rb +8 -0
- data/app_prototype/config/initializers/simple_form.rb +142 -0
- data/app_prototype/config/initializers/simple_form_bootstrap.rb +45 -0
- data/app_prototype/config/initializers/sorcery.rb +398 -0
- data/app_prototype/config/initializers/wrap_parameters.rb +14 -0
- data/app_prototype/config/locales/en.yml +5 -0
- data/app_prototype/config/locales/simple_form.en.yml +26 -0
- data/app_prototype/config/routes.rb +21 -0
- data/app_prototype/db/migrate/20121128215324_sorcery_core.rb +17 -0
- data/app_prototype/db/migrate/20121128215325_sorcery_brute_force_protection.rb +13 -0
- data/app_prototype/db/migrate/20121128215326_sorcery_activity_logging.rb +17 -0
- data/app_prototype/db/migrate/20121128215327_sorcery_user_activation.rb +17 -0
- data/app_prototype/db/migrate/20121128215328_sorcery_remember_me.rb +15 -0
- data/app_prototype/db/migrate/20121128215329_sorcery_reset_password.rb +17 -0
- data/app_prototype/db/migrate/20121128215330_sorcery_external.rb +14 -0
- data/app_prototype/db/migrate/20121128215337_add_admin_to_users.rb +5 -0
- data/{templates/_db → app_prototype/db}/sample_data.rb +0 -0
- data/app_prototype/db/schema.rb +53 -0
- data/app_prototype/db/seeds.rb +7 -0
- data/app_prototype/lib/assets/.gitkeep +0 -0
- data/app_prototype/lib/tasks/.gitkeep +0 -0
- data/{templates/_lib → app_prototype/lib}/tasks/coverage.rake +0 -0
- data/{templates/_lib → app_prototype/lib}/tasks/db.rake +0 -0
- data/{templates/_lib → app_prototype/lib}/tasks/spec.rake +0 -0
- data/{templates/_lib → app_prototype/lib}/templates/rails/scaffold_controller/controller.rb +0 -0
- data/{templates/_lib → app_prototype/lib}/templates/rspec/scaffold/controller_spec.rb +1 -1
- data/{templates/_lib → app_prototype/lib}/templates/slim/scaffold/_form.html.slim +0 -0
- data/{templates/_lib → app_prototype/lib}/templates/slim/scaffold/edit.html.slim +0 -0
- data/{templates/_lib → app_prototype/lib}/templates/slim/scaffold/index.html.slim +0 -0
- data/{templates/_lib → app_prototype/lib}/templates/slim/scaffold/new.html.slim +0 -0
- data/{templates/_lib → app_prototype/lib}/templates/slim/scaffold/show.html.slim +0 -0
- data/app_prototype/log/.gitkeep +0 -0
- data/app_prototype/public/404.html +26 -0
- data/app_prototype/public/422.html +26 -0
- data/app_prototype/public/500.html +25 -0
- data/app_prototype/public/favicon.ico +0 -0
- data/{templates/_public/index.html.erb → app_prototype/public/index.html} +2 -2
- data/app_prototype/public/robots.txt +5 -0
- data/app_prototype/script/rails +6 -0
- data/app_prototype/spec/controllers/user_sessions_controller_spec.rb +42 -0
- data/app_prototype/spec/controllers/users_controller_spec.rb +150 -0
- data/{templates/_spec → app_prototype/spec}/factories/users.rb +0 -0
- data/{templates/_spec → app_prototype/spec}/features/user_sessions_spec.rb +5 -1
- data/app_prototype/spec/helpers/users_helper_spec.rb +15 -0
- data/{templates/_spec → app_prototype/spec}/javascripts/example_spec.js.coffee +0 -0
- data/{templates/_spec → app_prototype/spec}/javascripts/spec.css +0 -0
- data/{templates/_spec → app_prototype/spec}/javascripts/spec.js.coffee +0 -0
- data/{templates/_spec → app_prototype/spec}/mailers/user_mailer_spec.rb +0 -0
- data/{templates/_spec → app_prototype/spec}/models/ability_spec.rb +0 -0
- data/{templates/_spec → app_prototype/spec}/models/user_spec.rb +0 -0
- data/app_prototype/spec/spec_helper.rb +84 -0
- data/{templates/_spec → app_prototype/spec}/support/accept_values.rb +0 -0
- data/{templates/_spec → app_prototype/spec}/support/factory_girl.rb +0 -0
- data/{templates/_spec → app_prototype/spec}/support/sorcery.rb +0 -0
- data/{templates/_spec → app_prototype/spec}/support/user_sessions_feature_helper.rb +0 -0
- data/app_prototype/spec/views/users/edit.html.slim_spec.rb +20 -0
- data/app_prototype/spec/views/users/index.html.slim_spec.rb +23 -0
- data/app_prototype/spec/views/users/new.html.slim_spec.rb +20 -0
- data/app_prototype/spec/views/users/show.html.slim_spec.rb +17 -0
- data/app_prototype/vendor/assets/javascripts/.gitkeep +0 -0
- data/app_prototype/vendor/assets/stylesheets/.gitkeep +0 -0
- data/app_prototype/vendor/plugins/.gitkeep +0 -0
- data/bin/raygun +48 -6
- data/lib/raygun/version.rb +1 -1
- data/raygun.gemspec +0 -3
- metadata +118 -108
- data/lib/raygun/actions.rb +0 -26
- data/lib/raygun/app_builder.rb +0 -362
- data/lib/raygun/generators/app_generator.rb +0 -188
- data/lib/raygun/helpers/ruby_version_helpers.rb +0 -52
- data/lib/raygun/raygun.rb +0 -11
- data/templates/rbenv-version.erb +0 -1
- data/templates/rvmrc.erb +0 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class SorceryCore < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :users do |t|
|
|
4
|
+
t.string :name
|
|
5
|
+
# t.string :username, :null => false # if you use another field as a username, for example email, you can safely remove this field.
|
|
6
|
+
t.string :email, default: nil # if you use this field as a username, you might want to make it :null => false.
|
|
7
|
+
t.string :crypted_password, default: nil
|
|
8
|
+
t.string :salt, default: nil
|
|
9
|
+
|
|
10
|
+
t.timestamps
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.down
|
|
15
|
+
drop_table :users
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class SorceryBruteForceProtection < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
add_column :users, :failed_logins_count, :integer, default: 0
|
|
4
|
+
add_column :users, :lock_expires_at, :datetime, default: nil
|
|
5
|
+
add_column :users, :unlock_token, :string, default: nil
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def self.down
|
|
9
|
+
remove_column :users, :lock_expires_at
|
|
10
|
+
remove_column :users, :failed_logins_count
|
|
11
|
+
remove_column :users, :unlock_token
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class SorceryActivityLogging < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
add_column :users, :last_login_at, :datetime, default: nil
|
|
4
|
+
add_column :users, :last_logout_at, :datetime, default: nil
|
|
5
|
+
add_column :users, :last_activity_at, :datetime, default: nil
|
|
6
|
+
|
|
7
|
+
add_index :users, [:last_logout_at, :last_activity_at]
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def self.down
|
|
11
|
+
remove_index :users, [:last_logout_at, :last_activity_at]
|
|
12
|
+
|
|
13
|
+
remove_column :users, :last_activity_at
|
|
14
|
+
remove_column :users, :last_logout_at
|
|
15
|
+
remove_column :users, :last_login_at
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class SorceryUserActivation < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
add_column :users, :activation_state, :string, default: nil
|
|
4
|
+
add_column :users, :activation_token, :string, default: nil
|
|
5
|
+
add_column :users, :activation_token_expires_at, :datetime, default: nil
|
|
6
|
+
|
|
7
|
+
add_index :users, :activation_token
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def self.down
|
|
11
|
+
remove_index :users, :activation_token
|
|
12
|
+
|
|
13
|
+
remove_column :users, :activation_token_expires_at
|
|
14
|
+
remove_column :users, :activation_token
|
|
15
|
+
remove_column :users, :activation_state
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class SorceryRememberMe < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
add_column :users, :remember_me_token, :string, default: nil
|
|
4
|
+
add_column :users, :remember_me_token_expires_at, :datetime, default: nil
|
|
5
|
+
|
|
6
|
+
add_index :users, :remember_me_token
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def self.down
|
|
10
|
+
remove_index :users, :remember_me_token
|
|
11
|
+
|
|
12
|
+
remove_column :users, :remember_me_token_expires_at
|
|
13
|
+
remove_column :users, :remember_me_token
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class SorceryResetPassword < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
add_column :users, :reset_password_token, :string, default: nil
|
|
4
|
+
add_column :users, :reset_password_token_expires_at, :datetime, default: nil
|
|
5
|
+
add_column :users, :reset_password_email_sent_at, :datetime, default: nil
|
|
6
|
+
|
|
7
|
+
add_index :users, :reset_password_token
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def self.down
|
|
11
|
+
remove_index :users, :reset_password_token
|
|
12
|
+
|
|
13
|
+
remove_column :users, :reset_password_email_sent_at
|
|
14
|
+
remove_column :users, :reset_password_token_expires_at
|
|
15
|
+
remove_column :users, :reset_password_token
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
class SorceryExternal < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :authentications do |t|
|
|
4
|
+
t.integer :user_id, null: false
|
|
5
|
+
t.string :provider, :uid, null: false
|
|
6
|
+
|
|
7
|
+
t.timestamps
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.down
|
|
12
|
+
drop_table :authentications
|
|
13
|
+
end
|
|
14
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
|
5
|
+
#
|
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
|
7
|
+
# database schema. If you need to create the application database on another
|
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
|
11
|
+
#
|
|
12
|
+
# It's strongly recommended to check this file into your version control system.
|
|
13
|
+
|
|
14
|
+
ActiveRecord::Schema.define(:version => 20121128215337) do
|
|
15
|
+
|
|
16
|
+
create_table "authentications", :force => true do |t|
|
|
17
|
+
t.integer "user_id", :null => false
|
|
18
|
+
t.string "provider", :null => false
|
|
19
|
+
t.string "uid", :null => false
|
|
20
|
+
t.datetime "created_at", :null => false
|
|
21
|
+
t.datetime "updated_at", :null => false
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
create_table "users", :force => true do |t|
|
|
25
|
+
t.string "name"
|
|
26
|
+
t.string "email"
|
|
27
|
+
t.string "crypted_password"
|
|
28
|
+
t.string "salt"
|
|
29
|
+
t.datetime "created_at", :null => false
|
|
30
|
+
t.datetime "updated_at", :null => false
|
|
31
|
+
t.integer "failed_logins_count", :default => 0
|
|
32
|
+
t.datetime "lock_expires_at"
|
|
33
|
+
t.string "unlock_token"
|
|
34
|
+
t.datetime "last_login_at"
|
|
35
|
+
t.datetime "last_logout_at"
|
|
36
|
+
t.datetime "last_activity_at"
|
|
37
|
+
t.string "activation_state"
|
|
38
|
+
t.string "activation_token"
|
|
39
|
+
t.datetime "activation_token_expires_at"
|
|
40
|
+
t.string "remember_me_token"
|
|
41
|
+
t.datetime "remember_me_token_expires_at"
|
|
42
|
+
t.string "reset_password_token"
|
|
43
|
+
t.datetime "reset_password_token_expires_at"
|
|
44
|
+
t.datetime "reset_password_email_sent_at"
|
|
45
|
+
t.boolean "admin"
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
add_index "users", ["activation_token"], :name => "index_users_on_activation_token"
|
|
49
|
+
add_index "users", ["last_logout_at", "last_activity_at"], :name => "index_users_on_last_logout_at_and_last_activity_at"
|
|
50
|
+
add_index "users", ["remember_me_token"], :name => "index_users_on_remember_me_token"
|
|
51
|
+
add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token"
|
|
52
|
+
|
|
53
|
+
end
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
|
2
|
+
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
|
3
|
+
#
|
|
4
|
+
# Examples:
|
|
5
|
+
#
|
|
6
|
+
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
|
7
|
+
# Mayor.create(name: 'Emanuel', city: cities.first)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -63,7 +63,7 @@ describe <%= controller_class_name %>Controller do
|
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
it "assigns a newly created <%= ns_file_name %> as @<%= ns_file_name %>" do
|
|
66
|
-
post :create,
|
|
66
|
+
post :create, {:<%= ns_file_name %> => valid_attributes }, valid_session
|
|
67
67
|
assigns(:<%= ns_file_name %>).should be_a(<%= class_name %>)
|
|
68
68
|
assigns(:<%= ns_file_name %>).should be_persisted
|
|
69
69
|
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
|
5
|
+
<style type="text/css">
|
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
|
7
|
+
div.dialog {
|
|
8
|
+
width: 25em;
|
|
9
|
+
padding: 0 4em;
|
|
10
|
+
margin: 4em auto 0 auto;
|
|
11
|
+
border: 1px solid #ccc;
|
|
12
|
+
border-right-color: #999;
|
|
13
|
+
border-bottom-color: #999;
|
|
14
|
+
}
|
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
|
16
|
+
</style>
|
|
17
|
+
</head>
|
|
18
|
+
|
|
19
|
+
<body>
|
|
20
|
+
<!-- This file lives in public/404.html -->
|
|
21
|
+
<div class="dialog">
|
|
22
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
|
23
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
|
24
|
+
</div>
|
|
25
|
+
</body>
|
|
26
|
+
</html>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
|
5
|
+
<style type="text/css">
|
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
|
7
|
+
div.dialog {
|
|
8
|
+
width: 25em;
|
|
9
|
+
padding: 0 4em;
|
|
10
|
+
margin: 4em auto 0 auto;
|
|
11
|
+
border: 1px solid #ccc;
|
|
12
|
+
border-right-color: #999;
|
|
13
|
+
border-bottom-color: #999;
|
|
14
|
+
}
|
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
|
16
|
+
</style>
|
|
17
|
+
</head>
|
|
18
|
+
|
|
19
|
+
<body>
|
|
20
|
+
<!-- This file lives in public/422.html -->
|
|
21
|
+
<div class="dialog">
|
|
22
|
+
<h1>The change you wanted was rejected.</h1>
|
|
23
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
|
24
|
+
</div>
|
|
25
|
+
</body>
|
|
26
|
+
</html>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
|
5
|
+
<style type="text/css">
|
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
|
7
|
+
div.dialog {
|
|
8
|
+
width: 25em;
|
|
9
|
+
padding: 0 4em;
|
|
10
|
+
margin: 4em auto 0 auto;
|
|
11
|
+
border: 1px solid #ccc;
|
|
12
|
+
border-right-color: #999;
|
|
13
|
+
border-bottom-color: #999;
|
|
14
|
+
}
|
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
|
16
|
+
</style>
|
|
17
|
+
</head>
|
|
18
|
+
|
|
19
|
+
<body>
|
|
20
|
+
<!-- This file lives in public/500.html -->
|
|
21
|
+
<div class="dialog">
|
|
22
|
+
<h1>We're sorry, but something went wrong.</h1>
|
|
23
|
+
</div>
|
|
24
|
+
</body>
|
|
25
|
+
</html>
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
|
-
<title
|
|
4
|
+
<title>Project_prototype</title>
|
|
5
5
|
<link href="/assets/application.css?body=1" media="all" rel="stylesheet" type="text/css"/>
|
|
6
6
|
<script src="/assets/jquery.js?body=1" type="text/javascript"></script>
|
|
7
7
|
<script src="/assets/jquery_ujs.js?body=1" type="text/javascript"></script>
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<header class="navbar navbar-fixed-top">
|
|
14
14
|
<nav class="navbar-inner">
|
|
15
15
|
<div class="container">
|
|
16
|
-
<div class="brand"
|
|
16
|
+
<div class="brand">Project_prototype</div>
|
|
17
17
|
<ul class="nav pull-right">
|
|
18
18
|
<li><a href="/sign_in">Sign in</a></li>
|
|
19
19
|
</ul>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
|
3
|
+
|
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
|
6
|
+
require 'rails/commands'
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe UserSessionsController do
|
|
4
|
+
|
|
5
|
+
describe "GET new" do
|
|
6
|
+
it "assigns a new user as @user" do
|
|
7
|
+
get :new
|
|
8
|
+
assigns(:user_session).should_not be_nil
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
describe "POST create" do
|
|
13
|
+
describe "with valid params" do
|
|
14
|
+
it "redirect to the target page" do
|
|
15
|
+
subject.stub(:login) { build_stubbed :user }
|
|
16
|
+
post :create, { user_session: { email: 'valid', password: 'valid' } }, { return_to_url: 'url' }
|
|
17
|
+
response.should redirect_to('url')
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe "with invalid params" do
|
|
22
|
+
it "re-renders the 'new' template" do
|
|
23
|
+
subject.stub(:login) { nil }
|
|
24
|
+
post :create, { user_session: { email: 'invalid', password: 'invalid' } }
|
|
25
|
+
response.should render_template('new')
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
describe "DELETE destroy" do
|
|
31
|
+
it "destroys the requested user session" do
|
|
32
|
+
subject.should_receive(:logout)
|
|
33
|
+
delete :destroy
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it "redirects to the sign in page" do
|
|
37
|
+
delete :destroy
|
|
38
|
+
response.should redirect_to(sign_in_url)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe UsersController do
|
|
4
|
+
|
|
5
|
+
# This should return the minimal set of attributes required to create a valid
|
|
6
|
+
# User. As you add validations to User, be sure to
|
|
7
|
+
# update the return value of this method accordingly.
|
|
8
|
+
def valid_attributes
|
|
9
|
+
attributes_for :user
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# This should return the minimal set of values that should be in the session
|
|
13
|
+
# in order to pass any filters (e.g. authentication) defined in
|
|
14
|
+
# UsersController. Be sure to keep this updated too.
|
|
15
|
+
def valid_session
|
|
16
|
+
{}
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
before do
|
|
20
|
+
login_user build :admin
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
describe "GET index" do
|
|
24
|
+
it "assigns all users as @users" do
|
|
25
|
+
user = User.create! valid_attributes
|
|
26
|
+
get :index, {}, valid_session
|
|
27
|
+
assigns(:users).should eq([user])
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
describe "GET show" do
|
|
32
|
+
it "assigns the requested user as @user" do
|
|
33
|
+
user = User.create! valid_attributes
|
|
34
|
+
get :show, { id: user.to_param }, valid_session
|
|
35
|
+
assigns(:user).should eq(user)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
describe "GET new" do
|
|
40
|
+
it "assigns a new user as @user" do
|
|
41
|
+
get :new, {}, valid_session
|
|
42
|
+
assigns(:user).should be_a_new(User)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
describe "GET edit" do
|
|
47
|
+
it "assigns the requested user as @user" do
|
|
48
|
+
user = User.create! valid_attributes
|
|
49
|
+
get :edit, { id: user.to_param }, valid_session
|
|
50
|
+
assigns(:user).should eq(user)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
describe "POST create" do
|
|
55
|
+
describe "with valid params" do
|
|
56
|
+
it "creates a new User" do
|
|
57
|
+
expect {
|
|
58
|
+
post :create, { user: valid_attributes }, valid_session
|
|
59
|
+
}.to change(User, :count).by(1)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it "assigns a newly created user as @user" do
|
|
63
|
+
post :create, {user: valid_attributes }, valid_session
|
|
64
|
+
assigns(:user).should be_a(User)
|
|
65
|
+
assigns(:user).should be_persisted
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
it "redirects to the created user" do
|
|
69
|
+
post :create, { user: valid_attributes }, valid_session
|
|
70
|
+
response.should redirect_to(User.last)
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
describe "with invalid params" do
|
|
75
|
+
it "assigns a newly created but unsaved user as @user" do
|
|
76
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
|
77
|
+
User.any_instance.stub(:save).and_return(false)
|
|
78
|
+
post :create, { user: { "email" => "invalid value" } }, valid_session
|
|
79
|
+
assigns(:user).should be_a_new(User)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
it "re-renders the 'new' template" do
|
|
83
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
|
84
|
+
User.any_instance.stub(:save).and_return(false)
|
|
85
|
+
post :create, { user: { "email" => "invalid value" } }, valid_session
|
|
86
|
+
response.should render_template("new")
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
describe "PUT update" do
|
|
92
|
+
describe "with valid params" do
|
|
93
|
+
it "updates the requested user" do
|
|
94
|
+
user = User.create! valid_attributes
|
|
95
|
+
# Assuming there are no other users in the database, this
|
|
96
|
+
# specifies that the User created on the previous line
|
|
97
|
+
# receives the :update_attributes message with whatever params are
|
|
98
|
+
# submitted in the request.
|
|
99
|
+
User.any_instance.should_receive(:update_attributes).with({ "email" => "MyString" })
|
|
100
|
+
put :update, { id: user.to_param, user: { "email" => "MyString" } }, valid_session
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
it "assigns the requested user as @user" do
|
|
104
|
+
user = User.create! valid_attributes
|
|
105
|
+
put :update, { id: user.to_param, user: valid_attributes }, valid_session
|
|
106
|
+
assigns(:user).should eq(user)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
it "redirects to the user" do
|
|
110
|
+
user = User.create! valid_attributes
|
|
111
|
+
put :update, { id: user.to_param, user: valid_attributes }, valid_session
|
|
112
|
+
response.should redirect_to(user)
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
describe "with invalid params" do
|
|
117
|
+
it "assigns the user as @user" do
|
|
118
|
+
user = User.create! valid_attributes
|
|
119
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
|
120
|
+
User.any_instance.stub(:save).and_return(false)
|
|
121
|
+
put :update, { id: user.to_param, user: { "email" => "invalid value" } }, valid_session
|
|
122
|
+
assigns(:user).should eq(user)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
it "re-renders the 'edit' template" do
|
|
126
|
+
user = User.create! valid_attributes
|
|
127
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
|
128
|
+
User.any_instance.stub(:save).and_return(false)
|
|
129
|
+
put :update, { id: user.to_param, user: { "email" => "invalid value" } }, valid_session
|
|
130
|
+
response.should render_template("edit")
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
describe "DELETE destroy" do
|
|
136
|
+
it "destroys the requested user" do
|
|
137
|
+
user = User.create! valid_attributes
|
|
138
|
+
expect {
|
|
139
|
+
delete :destroy, { id: user.to_param }, valid_session
|
|
140
|
+
}.to change(User, :count).by(-1)
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
it "redirects to the users list" do
|
|
144
|
+
user = User.create! valid_attributes
|
|
145
|
+
delete :destroy, { id: user.to_param }, valid_session
|
|
146
|
+
response.should redirect_to(users_url)
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
end
|