devise-authy 1.8.3 → 1.9.0
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.
- checksums.yaml +4 -4
- data/.gitignore +44 -0
- data/CHANGELOG.md +11 -0
- data/Gemfile +1 -12
- data/README.md +5 -3
- data/Rakefile +1 -14
- data/devise-authy.gemspec +34 -237
- data/lib/devise-authy.rb +1 -0
- data/lib/devise-authy/version.rb +5 -0
- data/lib/generators/active_record/devise_authy_generator.rb +11 -1
- data/lib/generators/active_record/templates/migration.rb +1 -1
- metadata +42 -195
- data/VERSION +0 -1
- data/authy-devise-demo/.gitignore +0 -15
- data/authy-devise-demo/Gemfile +0 -51
- data/authy-devise-demo/Gemfile.lock +0 -194
- data/authy-devise-demo/README.md +0 -64
- data/authy-devise-demo/Rakefile +0 -7
- data/authy-devise-demo/app/assets/images/rails.png +0 -0
- data/authy-devise-demo/app/assets/javascripts/application.js +0 -15
- data/authy-devise-demo/app/assets/javascripts/devise_authy.js +0 -12
- data/authy-devise-demo/app/assets/javascripts/welcome.js.coffee +0 -3
- data/authy-devise-demo/app/assets/stylesheets/application.css +0 -13
- data/authy-devise-demo/app/assets/stylesheets/devise_authy.css +0 -26
- data/authy-devise-demo/app/assets/stylesheets/welcome.css.scss +0 -3
- data/authy-devise-demo/app/controllers/application_controller.rb +0 -3
- data/authy-devise-demo/app/controllers/welcome_controller.rb +0 -15
- data/authy-devise-demo/app/helpers/application_helper.rb +0 -2
- data/authy-devise-demo/app/helpers/welcome_helper.rb +0 -2
- data/authy-devise-demo/app/mailers/.gitkeep +0 -0
- data/authy-devise-demo/app/models/.gitkeep +0 -0
- data/authy-devise-demo/app/models/admin.rb +0 -7
- data/authy-devise-demo/app/models/user.rb +0 -7
- data/authy-devise-demo/app/views/devise/devise_authy/enable_authy.html.erb +0 -7
- data/authy-devise-demo/app/views/devise/devise_authy/verify_authy.html.erb +0 -38
- data/authy-devise-demo/app/views/devise/devise_authy/verify_authy_installation.html.erb +0 -10
- data/authy-devise-demo/app/views/layouts/application.html.erb +0 -28
- data/authy-devise-demo/app/views/welcome/admin_page.html.erb +0 -12
- data/authy-devise-demo/app/views/welcome/index.html.erb +0 -5
- data/authy-devise-demo/app/views/welcome/user_page.html.erb +0 -5
- data/authy-devise-demo/config.ru +0 -4
- data/authy-devise-demo/config/application.rb +0 -26
- data/authy-devise-demo/config/boot.rb +0 -6
- data/authy-devise-demo/config/database.yml +0 -25
- data/authy-devise-demo/config/environment.rb +0 -5
- data/authy-devise-demo/config/environments/development.rb +0 -43
- data/authy-devise-demo/config/environments/production.rb +0 -79
- data/authy-devise-demo/config/environments/test.rb +0 -42
- data/authy-devise-demo/config/initializers/authy.rb +0 -1
- data/authy-devise-demo/config/initializers/backtrace_silencers.rb +0 -7
- data/authy-devise-demo/config/initializers/devise.rb +0 -240
- data/authy-devise-demo/config/initializers/inflections.rb +0 -15
- data/authy-devise-demo/config/initializers/mime_types.rb +0 -5
- data/authy-devise-demo/config/initializers/secret_token.rb +0 -7
- data/authy-devise-demo/config/initializers/session_store.rb +0 -8
- data/authy-devise-demo/config/initializers/wrap_parameters.rb +0 -14
- data/authy-devise-demo/config/locales/devise.authy.en.yml +0 -24
- data/authy-devise-demo/config/locales/devise.en.yml +0 -58
- data/authy-devise-demo/config/locales/en.yml +0 -5
- data/authy-devise-demo/config/routes.rb +0 -65
- data/authy-devise-demo/config/secrets.yml +0 -22
- data/authy-devise-demo/db/migrate/20130409234357_devise_create_users.rb +0 -46
- data/authy-devise-demo/db/migrate/20141202000744_devise_create_admins.rb +0 -46
- data/authy-devise-demo/db/migrate/20141202004246_devise_authy_add_to_admins.rb +0 -21
- data/authy-devise-demo/db/migrate/20160906221739_add_sessions_table.rb +0 -12
- data/authy-devise-demo/db/schema.rb +0 -72
- data/authy-devise-demo/db/seeds.rb +0 -7
- data/authy-devise-demo/lib/assets/.gitkeep +0 -0
- data/authy-devise-demo/lib/tasks/.gitkeep +0 -0
- data/authy-devise-demo/log/.gitkeep +0 -0
- data/authy-devise-demo/public/404.html +0 -26
- data/authy-devise-demo/public/422.html +0 -26
- data/authy-devise-demo/public/500.html +0 -25
- data/authy-devise-demo/public/favicon.ico +0 -0
- data/authy-devise-demo/public/robots.txt +0 -5
- data/authy-devise-demo/script/rails +0 -6
- data/authy-devise-demo/test/fixtures/.gitkeep +0 -0
- data/authy-devise-demo/test/fixtures/users.yml +0 -11
- data/authy-devise-demo/test/functional/.gitkeep +0 -0
- data/authy-devise-demo/test/functional/welcome_controller_test.rb +0 -9
- data/authy-devise-demo/test/integration/.gitkeep +0 -0
- data/authy-devise-demo/test/performance/browsing_test.rb +0 -12
- data/authy-devise-demo/test/test_helper.rb +0 -13
- data/authy-devise-demo/test/unit/.gitkeep +0 -0
- data/authy-devise-demo/test/unit/helpers/welcome_helper_test.rb +0 -4
- data/authy-devise-demo/test/unit/user_test.rb +0 -7
- data/authy-devise-demo/vendor/assets/javascripts/.gitkeep +0 -0
- data/authy-devise-demo/vendor/assets/stylesheets/.gitkeep +0 -0
- data/authy-devise-demo/vendor/plugins/.gitkeep +0 -0
- data/spec/controllers/devise_authy_controller_spec.rb +0 -360
- data/spec/controllers/passwords_controller_spec.rb +0 -48
- data/spec/features/authy_authenticatable_spec.rb +0 -108
- data/spec/features/authy_lockable_spec.rb +0 -70
- data/spec/generators_spec.rb +0 -32
- data/spec/models/authy_authenticatable_spec.rb +0 -17
- data/spec/models/authy_lockable_spec.rb +0 -81
- data/spec/orm/active_record.rb +0 -4
- data/spec/rails-app/Gemfile +0 -10
- data/spec/rails-app/Gemfile.lock +0 -141
- data/spec/rails-app/Rakefile +0 -7
- data/spec/rails-app/app/assets/images/rails.png +0 -0
- data/spec/rails-app/app/assets/javascripts/application.js +0 -15
- data/spec/rails-app/app/assets/javascripts/devise_authy.js +0 -12
- data/spec/rails-app/app/assets/javascripts/welcome.js +0 -2
- data/spec/rails-app/app/assets/stylesheets/application.css +0 -13
- data/spec/rails-app/app/assets/stylesheets/devise_authy.css +0 -26
- data/spec/rails-app/app/assets/stylesheets/welcome.css.scss +0 -3
- data/spec/rails-app/app/controllers/application_controller.rb +0 -3
- data/spec/rails-app/app/controllers/welcome_controller.rb +0 -13
- data/spec/rails-app/app/helpers/application_helper.rb +0 -2
- data/spec/rails-app/app/helpers/welcome_helper.rb +0 -2
- data/spec/rails-app/app/mailers/.gitkeep +0 -0
- data/spec/rails-app/app/models/.gitkeep +0 -0
- data/spec/rails-app/app/models/lockable_user.rb +0 -7
- data/spec/rails-app/app/models/user.rb +0 -8
- data/spec/rails-app/app/views/devise/devise_authy/enable_authy.html.erb +0 -7
- data/spec/rails-app/app/views/devise/devise_authy/verify_authy.html.erb +0 -37
- data/spec/rails-app/app/views/devise/devise_authy/verify_authy_installation.html.erb +0 -10
- data/spec/rails-app/app/views/layouts/application.html.erb +0 -28
- data/spec/rails-app/app/views/welcome/index.html.erb +0 -5
- data/spec/rails-app/config.ru +0 -4
- data/spec/rails-app/config/application.rb +0 -30
- data/spec/rails-app/config/boot.rb +0 -6
- data/spec/rails-app/config/database.yml +0 -25
- data/spec/rails-app/config/environment.rb +0 -5
- data/spec/rails-app/config/environments/development.rb +0 -43
- data/spec/rails-app/config/environments/production.rb +0 -79
- data/spec/rails-app/config/environments/test.rb +0 -44
- data/spec/rails-app/config/initializers/authy.rb +0 -2
- data/spec/rails-app/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/rails-app/config/initializers/devise.rb +0 -256
- data/spec/rails-app/config/initializers/inflections.rb +0 -15
- data/spec/rails-app/config/initializers/mime_types.rb +0 -5
- data/spec/rails-app/config/initializers/secret_token.rb +0 -7
- data/spec/rails-app/config/initializers/session_store.rb +0 -8
- data/spec/rails-app/config/initializers/wrap_parameters.rb +0 -14
- data/spec/rails-app/config/locales/devise.authy.en.yml +0 -24
- data/spec/rails-app/config/locales/devise.en.yml +0 -59
- data/spec/rails-app/config/locales/en.yml +0 -5
- data/spec/rails-app/config/routes.rb +0 -8
- data/spec/rails-app/config/secrets.yml +0 -22
- data/spec/rails-app/db/development.sqlite3 +0 -0
- data/spec/rails-app/db/migrate/20130419164907_devise_create_users.rb +0 -46
- data/spec/rails-app/db/migrate/20130419164936_devise_authy_add_to_users.rb +0 -18
- data/spec/rails-app/db/schema.rb +0 -41
- data/spec/rails-app/db/seeds.rb +0 -7
- 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 +0 -26
- data/spec/rails-app/public/422.html +0 -26
- data/spec/rails-app/public/500.html +0 -25
- data/spec/rails-app/public/favicon.ico +0 -0
- data/spec/rails-app/public/robots.txt +0 -5
- data/spec/rails-app/script/rails +0 -6
- data/spec/routing/routes_spec.rb +0 -35
- data/spec/spec_helper.rb +0 -46
- data/spec/support/helpers.rb +0 -80
|
Binary file
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
class DeviseCreateUsers < ActiveRecord::Migration
|
|
2
|
-
def change
|
|
3
|
-
create_table(:users) 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
|
-
|
|
37
|
-
t.timestamps
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
add_index :users, :email, :unique => true
|
|
41
|
-
add_index :users, :reset_password_token, :unique => true
|
|
42
|
-
# add_index :users, :confirmation_token, :unique => true
|
|
43
|
-
# add_index :users, :unlock_token, :unique => true
|
|
44
|
-
# add_index :users, :authentication_token, :unique => true
|
|
45
|
-
end
|
|
46
|
-
end
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
class DeviseAuthyAddToUsers < ActiveRecord::Migration
|
|
2
|
-
def self.up
|
|
3
|
-
change_table :users do |t|
|
|
4
|
-
t.string :authy_id
|
|
5
|
-
t.datetime :last_sign_in_with_authy
|
|
6
|
-
t.boolean :authy_enabled, :default => false
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
add_index :users, :authy_id
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def self.down
|
|
13
|
-
change_table :users do |t|
|
|
14
|
-
t.remove :authy_id, :last_sign_in_with_authy, :authy_enabled
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
data/spec/rails-app/db/schema.rb
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
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 => 20130419164936) do
|
|
15
|
-
|
|
16
|
-
create_table "users", :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.integer "failed_attempts", :default => 0
|
|
28
|
-
t.string "unlock_token"
|
|
29
|
-
t.datetime "locked_at"
|
|
30
|
-
t.datetime "created_at", :null => false
|
|
31
|
-
t.datetime "updated_at", :null => false
|
|
32
|
-
t.string "authy_id"
|
|
33
|
-
t.datetime "last_sign_in_with_authy"
|
|
34
|
-
t.boolean "authy_enabled", :default => false
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
add_index "users", ["authy_id"], :name => "index_users_on_authy_id"
|
|
38
|
-
add_index "users", ["email"], :name => "index_users_on_email", :unique => true
|
|
39
|
-
add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
|
|
40
|
-
|
|
41
|
-
end
|
data/spec/rails-app/db/seeds.rb
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
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
|
|
@@ -1,26 +0,0 @@
|
|
|
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>
|
|
@@ -1,26 +0,0 @@
|
|
|
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>
|
|
@@ -1,25 +0,0 @@
|
|
|
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
|
data/spec/rails-app/script/rails
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
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/routing/routes_spec.rb
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe "routes for devise_authy" do
|
|
4
|
-
it "route to devise_authy#GET_verify_authy" do
|
|
5
|
-
expect(get('/users/verify_authy')).to route_to("devise/devise_authy#GET_verify_authy")
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
it "routes to devise_authy#POST_verify_authy" do
|
|
9
|
-
expect(post('/users/verify_authy')).to route_to("devise/devise_authy#POST_verify_authy")
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
it "routes to devise_authy#GET_enable_authy" do
|
|
13
|
-
expect(get('/users/enable_authy')).to route_to("devise/devise_authy#GET_enable_authy")
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
it "routes to devise_authy#POST_enable_authy" do
|
|
17
|
-
expect(post('/users/enable_authy')).to route_to("devise/devise_authy#POST_enable_authy")
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
it "route to devise_authy#GET_verify_authy_installation" do
|
|
21
|
-
expect(get('/users/verify_authy_installation')).to route_to("devise/devise_authy#GET_verify_authy_installation")
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
it "routes to devise_authy#POST_verify_authy_installation" do
|
|
25
|
-
expect(post('/users/verify_authy_installation')).to route_to("devise/devise_authy#POST_verify_authy_installation")
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
it "routes to devise_authy#request_sms" do
|
|
29
|
-
expect(post('/users/request-sms')).to route_to("devise/devise_authy#request_sms")
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
it "routes to devise_authy#GET_authy_onetouch_status" do
|
|
33
|
-
expect(get('/users/authy_onetouch_status')).to route_to("devise/devise_authy#GET_authy_onetouch_status")
|
|
34
|
-
end
|
|
35
|
-
end
|
data/spec/spec_helper.rb
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
ENV["RAILS_ENV"] ||= 'test'
|
|
2
|
-
|
|
3
|
-
require 'simplecov'
|
|
4
|
-
SimpleCov.start
|
|
5
|
-
|
|
6
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
7
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
8
|
-
|
|
9
|
-
require "rails-app/config/environment"
|
|
10
|
-
require 'rspec/rails'
|
|
11
|
-
require 'devise-authy'
|
|
12
|
-
require 'orm/active_record'
|
|
13
|
-
require 'capybara/rails'
|
|
14
|
-
require 'capybara/rspec'
|
|
15
|
-
require 'database_cleaner'
|
|
16
|
-
|
|
17
|
-
# Requires supporting files with custom matchers and macros, etc,
|
|
18
|
-
# in ./support/ and its subdirectories.
|
|
19
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
|
20
|
-
|
|
21
|
-
RSpec.configure do |config|
|
|
22
|
-
config.before :suite do
|
|
23
|
-
DatabaseCleaner[:active_record].strategy = :truncation
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
config.before :each do
|
|
27
|
-
DatabaseCleaner.start
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
config.after :each do
|
|
31
|
-
DatabaseCleaner.clean
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
config.include Capybara::DSL
|
|
35
|
-
|
|
36
|
-
# rspec-rails 3 will no longer automatically infer an example group's spec type
|
|
37
|
-
# from the file location. You can explicitly opt-in to the feature using this
|
|
38
|
-
# config option.
|
|
39
|
-
# To explicitly tag specs without using automatic inference, set the `:type`
|
|
40
|
-
# metadata manually:
|
|
41
|
-
#
|
|
42
|
-
# describe ThingsController, :type => :controller do
|
|
43
|
-
# # Equivalent to being in spec/controllers
|
|
44
|
-
# end
|
|
45
|
-
config.infer_spec_type_from_file_location!
|
|
46
|
-
end
|
data/spec/support/helpers.rb
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
$email_count ||= 0
|
|
2
|
-
def generate_unique_email
|
|
3
|
-
$email_count += 1
|
|
4
|
-
"test#{$email_count}@example.com"
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
def valid_attributes(attributes={})
|
|
8
|
-
{ :email => generate_unique_email,
|
|
9
|
-
:password => '12345678',
|
|
10
|
-
:password_confirmation => '12345678' }.update(attributes)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def new_user(attributes={})
|
|
14
|
-
User.new(valid_attributes(attributes))
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def create_user(attributes={})
|
|
18
|
-
User.create!(valid_attributes(attributes))
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def create_lockable_user(attributes={})
|
|
22
|
-
LockableUser.create!(valid_attributes(attributes))
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def fill_sign_in_form(email, password, form_selector = nil, sign_in_path = nil)
|
|
26
|
-
form_selector ||= '#new_user'
|
|
27
|
-
sign_in_path ||= new_user_session_path
|
|
28
|
-
|
|
29
|
-
visit sign_in_path
|
|
30
|
-
|
|
31
|
-
# save_and_open_page
|
|
32
|
-
within(form_selector) do
|
|
33
|
-
fill_in 'Email', :with => email
|
|
34
|
-
fill_in 'Password', :with => password
|
|
35
|
-
end
|
|
36
|
-
click_button 'Log in'
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def fill_verify_token_form(token)
|
|
40
|
-
within('#devise_authy') { fill_in 'authy-token', with: token }
|
|
41
|
-
click_on 'Check Token'
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def fill_in_verify_authy_installation_form(token)
|
|
45
|
-
fill_in 'authy-token', with: token
|
|
46
|
-
click_on 'Enable my account'
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def sign_cookie(name, val)
|
|
50
|
-
verifier = ActiveSupport::MessageVerifier.new(RailsApp::Application.config.secret_token)
|
|
51
|
-
verifier.generate(val)
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
def too_many_failed_attempts
|
|
55
|
-
Devise.maximum_attempts + 1
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def valid_authy_token
|
|
59
|
-
'0000000'
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
def invalid_authy_token
|
|
63
|
-
'999999'
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def lock_user_account
|
|
67
|
-
too_many_failed_attempts.times { fill_verify_token_form invalid_authy_token }
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
def assert_at(path)
|
|
71
|
-
expect(current_path).to eq(path)
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
def assert_not_at(path)
|
|
75
|
-
expect(current_path).not_to eq(path)
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
def assert_account_locked_for(user, is_locked = true)
|
|
79
|
-
expect(user.access_locked?).to eq(is_locked)
|
|
80
|
-
end
|