devise-multi-radius-authenticatable 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/.rspec +2 -0
- data/.travis.yml +7 -0
- data/Gemfile +3 -0
- data/MIT-LICENSE +21 -0
- data/README.md +85 -0
- data/Rakefile +16 -0
- data/devise-multi-radius-authenticatable.gemspec +32 -0
- data/lib/devise-radius-authenticatable.rb +8 -0
- data/lib/devise/models/radius_authenticatable.rb +187 -0
- data/lib/devise/radius_authenticatable.rb +45 -0
- data/lib/devise/radius_authenticatable/test_helpers.rb +126 -0
- data/lib/devise/radius_authenticatable/version.rb +5 -0
- data/lib/devise/strategies/radius_authenticatable.rb +30 -0
- data/lib/generators/devise_radius_authenticatable/install_generator.rb +93 -0
- data/spec/devise/models/radius_authenticatable_spec.rb +170 -0
- data/spec/factories/admins.rb +10 -0
- data/spec/fixtures/devise.rb +238 -0
- data/spec/generators/install_generator_spec.rb +66 -0
- data/spec/integration/radius_authenticatable_spec.rb +115 -0
- data/spec/rails_app/.gitignore +15 -0
- data/spec/rails_app/Gemfile +4 -0
- data/spec/rails_app/Rakefile +7 -0
- data/spec/rails_app/app/assets/images/rails.png +0 -0
- data/spec/rails_app/app/assets/javascripts/application.js +13 -0
- data/spec/rails_app/app/assets/stylesheets/application.css +13 -0
- data/spec/rails_app/app/controllers/admins_controller.rb +83 -0
- data/spec/rails_app/app/controllers/application_controller.rb +11 -0
- data/spec/rails_app/app/helpers/application_helper.rb +2 -0
- data/spec/rails_app/app/mailers/.gitkeep +0 -0
- data/spec/rails_app/app/models/.gitkeep +0 -0
- data/spec/rails_app/app/models/admin.rb +11 -0
- data/spec/rails_app/app/views/admins/_form.html.erb +17 -0
- data/spec/rails_app/app/views/admins/edit.html.erb +6 -0
- data/spec/rails_app/app/views/admins/index.html.erb +21 -0
- data/spec/rails_app/app/views/admins/new.html.erb +5 -0
- data/spec/rails_app/app/views/admins/show.html.erb +5 -0
- data/spec/rails_app/app/views/devise/confirmations/new.html.erb +12 -0
- data/spec/rails_app/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/spec/rails_app/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/spec/rails_app/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/spec/rails_app/app/views/devise/passwords/edit.html.erb +16 -0
- data/spec/rails_app/app/views/devise/passwords/new.html.erb +12 -0
- data/spec/rails_app/app/views/devise/registrations/edit.html.erb +29 -0
- data/spec/rails_app/app/views/devise/registrations/new.html.erb +18 -0
- data/spec/rails_app/app/views/devise/sessions/new.html.erb +17 -0
- data/spec/rails_app/app/views/devise/shared/_links.erb +25 -0
- data/spec/rails_app/app/views/devise/unlocks/new.html.erb +12 -0
- data/spec/rails_app/app/views/layouts/application.html.erb +25 -0
- data/spec/rails_app/bin/bundle +3 -0
- data/spec/rails_app/bin/rails +4 -0
- data/spec/rails_app/bin/rake +4 -0
- data/spec/rails_app/config.ru +4 -0
- data/spec/rails_app/config/application.rb +23 -0
- data/spec/rails_app/config/boot.rb +4 -0
- data/spec/rails_app/config/database.yml +25 -0
- data/spec/rails_app/config/environment.rb +5 -0
- data/spec/rails_app/config/environments/development.rb +29 -0
- data/spec/rails_app/config/environments/production.rb +80 -0
- data/spec/rails_app/config/environments/test.rb +36 -0
- data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/rails_app/config/initializers/devise.rb +308 -0
- data/spec/rails_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/rails_app/config/initializers/inflections.rb +16 -0
- data/spec/rails_app/config/initializers/mime_types.rb +5 -0
- data/spec/rails_app/config/initializers/secret_token.rb +12 -0
- data/spec/rails_app/config/initializers/session_store.rb +3 -0
- data/spec/rails_app/config/initializers/wrap_parameters.rb +14 -0
- data/spec/rails_app/config/locales/devise.en.yml +59 -0
- data/spec/rails_app/config/locales/en.yml +23 -0
- data/spec/rails_app/config/routes.rb +63 -0
- data/spec/rails_app/db/migrate/20120627042556_devise_create_admins.rb +48 -0
- data/spec/rails_app/db/schema.rb +37 -0
- data/spec/rails_app/db/seeds.rb +7 -0
- data/spec/rails_app/lib/assets/.gitkeep +0 -0
- data/spec/rails_app/lib/tasks/.gitkeep +0 -0
- data/spec/rails_app/public/404.html +26 -0
- data/spec/rails_app/public/422.html +26 -0
- data/spec/rails_app/public/500.html +25 -0
- data/spec/rails_app/public/favicon.ico +0 -0
- data/spec/rails_app/public/robots.txt +5 -0
- data/spec/rails_app/script/rails +6 -0
- data/spec/spec_helper.rb +28 -0
- data/spec/support/devise_helpers.rb +18 -0
- data/spec/support/generator_helpers.rb +16 -0
- metadata +359 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format. Inflections
|
4
|
+
# are locale specific, and you may define rules for as many different
|
5
|
+
# locales as you wish. All of these examples are active by default:
|
6
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
7
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
8
|
+
# inflect.singular /^(ox)en/i, '\1'
|
9
|
+
# inflect.irregular 'person', 'people'
|
10
|
+
# inflect.uncountable %w( fish sheep )
|
11
|
+
# end
|
12
|
+
|
13
|
+
# These inflection rules are supported but not enabled by default:
|
14
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
15
|
+
# inflect.acronym 'RESTful'
|
16
|
+
# end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
|
6
|
+
# Make sure the secret is at least 30 characters and all random,
|
7
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
+
# You can use `rake secret` to generate a secure secret key.
|
9
|
+
|
10
|
+
# Make sure your secret_key_base is kept private
|
11
|
+
# if you're sharing your code publicly.
|
12
|
+
RailsApp::Application.config.secret_key_base = 'e7d38f6a36bec133553aa2eff66426de29a85d45a30007280b716c58e8ee027830bd76d12ae479c44bfa9f18cdaa79441c729dd51fb02d57b2cd566a5045f772'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
9
|
+
end
|
10
|
+
|
11
|
+
# To enable root element in JSON for ActiveRecord objects.
|
12
|
+
# ActiveSupport.on_load(:active_record) do
|
13
|
+
# self.include_root_in_json = true
|
14
|
+
# end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
|
2
|
+
|
3
|
+
en:
|
4
|
+
devise:
|
5
|
+
confirmations:
|
6
|
+
confirmed: "Your account was successfully confirmed."
|
7
|
+
send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
|
8
|
+
send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
|
9
|
+
failure:
|
10
|
+
already_authenticated: "You are already signed in."
|
11
|
+
inactive: "Your account is not activated yet."
|
12
|
+
invalid: "Invalid email or password."
|
13
|
+
locked: "Your account is locked."
|
14
|
+
last_attempt: "You have one more attempt before your account will be locked."
|
15
|
+
not_found_in_database: "Invalid email or password."
|
16
|
+
timeout: "Your session expired. Please sign in again to continue."
|
17
|
+
unauthenticated: "You need to sign in or sign up before continuing."
|
18
|
+
unconfirmed: "You have to confirm your account before continuing."
|
19
|
+
mailer:
|
20
|
+
confirmation_instructions:
|
21
|
+
subject: "Confirmation instructions"
|
22
|
+
reset_password_instructions:
|
23
|
+
subject: "Reset password instructions"
|
24
|
+
unlock_instructions:
|
25
|
+
subject: "Unlock Instructions"
|
26
|
+
omniauth_callbacks:
|
27
|
+
failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
|
28
|
+
success: "Successfully authenticated from %{kind} account."
|
29
|
+
passwords:
|
30
|
+
no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
|
31
|
+
send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
|
32
|
+
send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
|
33
|
+
updated: "Your password was changed successfully. You are now signed in."
|
34
|
+
updated_not_active: "Your password was changed successfully."
|
35
|
+
registrations:
|
36
|
+
destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon."
|
37
|
+
signed_up: "Welcome! You have signed up successfully."
|
38
|
+
signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
|
39
|
+
signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
|
40
|
+
signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account."
|
41
|
+
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
|
42
|
+
updated: "You updated your account successfully."
|
43
|
+
sessions:
|
44
|
+
signed_in: "Signed in successfully."
|
45
|
+
signed_out: "Signed out successfully."
|
46
|
+
unlocks:
|
47
|
+
send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes."
|
48
|
+
send_paranoid_instructions: "If your account exists, you will receive an email with instructions about how to unlock it in a few minutes."
|
49
|
+
unlocked: "Your account has been unlocked successfully. Please sign in to continue."
|
50
|
+
errors:
|
51
|
+
messages:
|
52
|
+
already_confirmed: "was already confirmed, please try signing in"
|
53
|
+
confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
|
54
|
+
expired: "has expired, please request a new one"
|
55
|
+
not_found: "not found"
|
56
|
+
not_locked: "was not locked"
|
57
|
+
not_saved:
|
58
|
+
one: "1 error prohibited this %{resource} from being saved:"
|
59
|
+
other: "%{count} errors prohibited this %{resource} from being saved:"
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Files in the config/locales directory are used for internationalization
|
2
|
+
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
+
# than English, add the necessary files in this directory.
|
4
|
+
#
|
5
|
+
# To use the locales, use `I18n.t`:
|
6
|
+
#
|
7
|
+
# I18n.t 'hello'
|
8
|
+
#
|
9
|
+
# In views, this is aliased to just `t`:
|
10
|
+
#
|
11
|
+
# <%= t('hello') %>
|
12
|
+
#
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
14
|
+
#
|
15
|
+
# I18n.locale = :es
|
16
|
+
#
|
17
|
+
# This would use the information in config/locales/es.yml.
|
18
|
+
#
|
19
|
+
# To learn more, please read the Rails Internationalization guide
|
20
|
+
# available at http://guides.rubyonrails.org/i18n.html.
|
21
|
+
|
22
|
+
en:
|
23
|
+
hello: "Hello world"
|
@@ -0,0 +1,63 @@
|
|
1
|
+
RailsApp::Application.routes.draw do
|
2
|
+
devise_for :admins, :skip => [:sessions]
|
3
|
+
as :admin do
|
4
|
+
get 'signin' => 'devise/sessions#new', :as => :new_admin_session
|
5
|
+
post 'signin' => 'devise/sessions#create', :as => :admin_session
|
6
|
+
delete 'signout' => 'devise/sessions#destroy', :as => :destroy_admin_session
|
7
|
+
end
|
8
|
+
# The priority is based upon order of creation: first created -> highest priority.
|
9
|
+
# See how all your routes lay out with "rake routes".
|
10
|
+
|
11
|
+
# You can have the root of your site routed with "root"
|
12
|
+
root :to => 'admins#index'
|
13
|
+
|
14
|
+
# Example of regular route:
|
15
|
+
# get 'products/:id' => 'catalog#view'
|
16
|
+
|
17
|
+
# Example of named route that can be invoked with purchase_url(id: product.id)
|
18
|
+
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
|
19
|
+
|
20
|
+
# Example resource route (maps HTTP verbs to controller actions automatically):
|
21
|
+
# resources :products
|
22
|
+
resources :admins
|
23
|
+
|
24
|
+
# Example resource route with options:
|
25
|
+
# resources :products do
|
26
|
+
# member do
|
27
|
+
# get 'short'
|
28
|
+
# post 'toggle'
|
29
|
+
# end
|
30
|
+
#
|
31
|
+
# collection do
|
32
|
+
# get 'sold'
|
33
|
+
# end
|
34
|
+
# end
|
35
|
+
|
36
|
+
# Example resource route with sub-resources:
|
37
|
+
# resources :products do
|
38
|
+
# resources :comments, :sales
|
39
|
+
# resource :seller
|
40
|
+
# end
|
41
|
+
|
42
|
+
# Example resource route with more complex sub-resources:
|
43
|
+
# resources :products do
|
44
|
+
# resources :comments
|
45
|
+
# resources :sales do
|
46
|
+
# get 'recent', on: :collection
|
47
|
+
# end
|
48
|
+
# end
|
49
|
+
|
50
|
+
# Example resource route with concerns:
|
51
|
+
# concern :toggleable do
|
52
|
+
# post 'toggle'
|
53
|
+
# end
|
54
|
+
# resources :posts, concerns: :toggleable
|
55
|
+
# resources :photos, concerns: :toggleable
|
56
|
+
|
57
|
+
# Example resource route within a namespace:
|
58
|
+
# namespace :admin do
|
59
|
+
# # Directs /admin/products/* to Admin::ProductsController
|
60
|
+
# # (app/controllers/admin/products_controller.rb)
|
61
|
+
# resources :products
|
62
|
+
# end
|
63
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
class DeviseCreateAdmins < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table(:admins) do |t|
|
4
|
+
## Database authenticatable
|
5
|
+
t.string :email, :null => false, :default => ""
|
6
|
+
t.string :encrypted_password, :null => false, :default => ""
|
7
|
+
|
8
|
+
## Recoverable
|
9
|
+
t.string :reset_password_token
|
10
|
+
t.datetime :reset_password_sent_at
|
11
|
+
|
12
|
+
## Rememberable
|
13
|
+
t.datetime :remember_created_at
|
14
|
+
|
15
|
+
## Trackable
|
16
|
+
t.integer :sign_in_count, :default => 0
|
17
|
+
t.datetime :current_sign_in_at
|
18
|
+
t.datetime :last_sign_in_at
|
19
|
+
t.string :current_sign_in_ip
|
20
|
+
t.string :last_sign_in_ip
|
21
|
+
|
22
|
+
## Confirmable
|
23
|
+
# t.string :confirmation_token
|
24
|
+
# t.datetime :confirmed_at
|
25
|
+
# t.datetime :confirmation_sent_at
|
26
|
+
# t.string :unconfirmed_email # Only if using reconfirmable
|
27
|
+
|
28
|
+
## Lockable
|
29
|
+
# t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
|
30
|
+
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
31
|
+
# t.datetime :locked_at
|
32
|
+
|
33
|
+
## Token authenticatable
|
34
|
+
t.string :authentication_token
|
35
|
+
|
36
|
+
## Radius authenticatable
|
37
|
+
t.string :uid
|
38
|
+
|
39
|
+
t.timestamps
|
40
|
+
end
|
41
|
+
|
42
|
+
add_index :admins, :email, :unique => true
|
43
|
+
add_index :admins, :reset_password_token, :unique => true
|
44
|
+
# add_index :admins, :confirmation_token, :unique => true
|
45
|
+
# add_index :admins, :unlock_token, :unique => true
|
46
|
+
add_index :admins, :authentication_token, :unique => true
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,37 @@
|
|
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 that you check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(version: 20120627042556) do
|
15
|
+
|
16
|
+
create_table "admins", force: true do |t|
|
17
|
+
t.string "email", default: "", null: false
|
18
|
+
t.string "encrypted_password", default: "", null: false
|
19
|
+
t.string "reset_password_token"
|
20
|
+
t.datetime "reset_password_sent_at"
|
21
|
+
t.datetime "remember_created_at"
|
22
|
+
t.integer "sign_in_count", default: 0
|
23
|
+
t.datetime "current_sign_in_at"
|
24
|
+
t.datetime "last_sign_in_at"
|
25
|
+
t.string "current_sign_in_ip"
|
26
|
+
t.string "last_sign_in_ip"
|
27
|
+
t.string "authentication_token"
|
28
|
+
t.string "uid"
|
29
|
+
t.datetime "created_at"
|
30
|
+
t.datetime "updated_at"
|
31
|
+
end
|
32
|
+
|
33
|
+
add_index "admins", ["authentication_token"], name: "index_admins_on_authentication_token", unique: true
|
34
|
+
add_index "admins", ["email"], name: "index_admins_on_email", unique: true
|
35
|
+
add_index "admins", ["reset_password_token"], name: "index_admins_on_reset_password_token", unique: true
|
36
|
+
|
37
|
+
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
|
@@ -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
|
@@ -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'
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
ENV["RAILS_ENV"] ||= 'test'
|
2
|
+
|
3
|
+
require 'rails_app/config/environment'
|
4
|
+
|
5
|
+
require 'rspec/rails'
|
6
|
+
require 'ammeter/init'
|
7
|
+
require 'factory_girl'
|
8
|
+
|
9
|
+
# Load in all of our supporting code
|
10
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
11
|
+
Dir["#{File.dirname(__FILE__)}/factories/**/*.rb"].each {|f| require f}
|
12
|
+
|
13
|
+
# Make sure to get the database migrated
|
14
|
+
ActiveRecord::Migration.verbose = false
|
15
|
+
ActiveRecord::Base.logger = Logger.new(nil)
|
16
|
+
ActiveRecord::Migrator.migrate(File.expand_path("../rails_app/db/migrate/", __FILE__))
|
17
|
+
|
18
|
+
# RSpec Configuration
|
19
|
+
RSpec.configure do |config|
|
20
|
+
config.use_transactional_fixtures = true
|
21
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
22
|
+
config.run_all_when_everything_filtered = true
|
23
|
+
config.filter_run :focus
|
24
|
+
config.order = 'random'
|
25
|
+
|
26
|
+
config.include Devise::RadiusAuthenticatable::TestHelpers
|
27
|
+
config.include Capybara::DSL
|
28
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module DeviseHelpers
|
2
|
+
# Execute the block setting the given values and restoring old values after
|
3
|
+
# the block is executed.
|
4
|
+
def swap(object, new_values)
|
5
|
+
old_values = {}
|
6
|
+
new_values.each do |key, value|
|
7
|
+
old_values[key] = object.send key
|
8
|
+
object.send :"#{key}=", value
|
9
|
+
end
|
10
|
+
yield
|
11
|
+
ensure
|
12
|
+
old_values.each do |key, value|
|
13
|
+
object.send :"#{key}=", value
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
RSpec::configure { |c| c.include DeviseHelpers }
|