tb_banners 1.2.1 → 1.3.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +2 -12
- data/Rakefile +2 -5
- data/app/assets/javascripts/admin/banners/banners.js +34 -41
- data/app/controllers/admin/banner_sets_controller.rb +15 -19
- data/app/controllers/admin/banners_controller.rb +30 -52
- data/app/helpers/spud_banners_helper.rb +12 -12
- data/app/models/spud_banner.rb +18 -18
- data/app/models/spud_banner_set.rb +15 -17
- data/app/views/admin/banners/_form.html.erb +1 -3
- data/lib/spud_banners/configuration.rb +2 -2
- data/lib/spud_banners/engine.rb +6 -6
- data/lib/spud_banners/liquid_tags.rb +6 -3
- data/lib/spud_banners/version.rb +1 -1
- data/lib/tb_banners.rb +1 -1
- data/spec/authlogic_helper.rb +1 -1
- data/spec/controllers/admin/banner_sets_controller_spec.rb +33 -33
- data/spec/dummy/config/application.rb +2 -3
- data/spec/dummy/config/boot.rb +1 -1
- data/spec/dummy/config/environments/production.rb +1 -1
- data/spec/dummy/config/environments/test.rb +3 -6
- data/spec/dummy/config.ru +1 -1
- data/spec/dummy/db/migrate/20121127192247_create_spud_users.spud_core.rb +12 -12
- data/spec/dummy/db/migrate/20121127192248_add_time_zone_to_spud_user.spud_core.rb +0 -1
- data/spec/dummy/db/migrate/20121127192249_add_scope_to_spud_admin_permissions.spud_core.rb +0 -1
- data/spec/dummy/db/migrate/20130920154443_create_spud_permissions.tb_core.rb +3 -3
- data/spec/dummy/db/migrate/20130920154444_create_spud_role_permissions.tb_core.rb +2 -2
- data/spec/dummy/db/migrate/20130920154446_create_spud_banners.tb_banners.rb +4 -4
- data/spec/dummy/db/migrate/20130920154447_create_spud_banner_sets.tb_banners.rb +5 -5
- data/spec/dummy/db/migrate/20130920154448_add_rich_text_to_spud_banners.tb_banners.rb +1 -1
- data/spec/dummy/db/migrate/20160310164644_add_requires_password_change_to_spud_users.tb_core.rb +1 -1
- data/spec/dummy/db/schema.rb +85 -92
- data/spec/dummy/script/rails +2 -2
- data/spec/rails_helper.rb +12 -5
- data/spec/spec_helper.rb +42 -44
- metadata +72 -31
- data/app/views/admin/banners/legacy.js.erb +0 -5
@@ -1,18 +1,18 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
describe Admin::BannerSetsController, :
|
3
|
+
describe Admin::BannerSetsController, type: 'controller' do
|
4
4
|
|
5
5
|
before(:each) do
|
6
6
|
activate_authlogic
|
7
|
-
u = SpudUser.new(:
|
7
|
+
u = SpudUser.new(login: 'testuser', email: 'test@testuser.com', password: 'test', password_confirmation: 'test')
|
8
8
|
u.super_admin = true
|
9
9
|
u.save
|
10
10
|
@user = SpudUserSession.create(u)
|
11
11
|
end
|
12
12
|
|
13
13
|
describe 'index' do
|
14
|
-
it
|
15
|
-
5.times do |
|
14
|
+
it 'should return an array of banner sets' do
|
15
|
+
5.times do |_x|
|
16
16
|
banner_set = FactoryGirl.create(:spud_banner_set)
|
17
17
|
end
|
18
18
|
get :index
|
@@ -21,79 +21,79 @@ describe Admin::BannerSetsController, :type => 'controller' do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
describe 'show' do
|
24
|
-
it
|
24
|
+
it 'should respond with a banner set' do
|
25
25
|
banner_set = FactoryGirl.create(:spud_banner_set)
|
26
|
-
get :show, :id
|
26
|
+
get :show, params: { id: banner_set.id }
|
27
27
|
expect(assigns(:banner_set)).to eq(banner_set)
|
28
28
|
expect(response).to be_success
|
29
29
|
end
|
30
30
|
|
31
|
-
it
|
32
|
-
get :show, :id
|
31
|
+
it 'should redirect if banner set is not found' do
|
32
|
+
get :show, params: { id: -1 }
|
33
33
|
expect(assigns(:banner_set)).to be_blank
|
34
34
|
expect(response).to redirect_to admin_banner_sets_path
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
describe 'new' do
|
39
|
-
it
|
39
|
+
it 'should respond with a banner set' do
|
40
40
|
get :new
|
41
41
|
expect(response).to be_success
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
describe 'create' do
|
46
|
-
it
|
47
|
-
expect
|
48
|
-
post :create, :spud_banner_set
|
49
|
-
|
46
|
+
it 'should respond with a banner set' do
|
47
|
+
expect do
|
48
|
+
post :create, params: { spud_banner_set: FactoryGirl.attributes_for(:spud_banner_set) }
|
49
|
+
end.to change(SpudBannerSet, :count).by(1)
|
50
50
|
expect(response).to be_success
|
51
51
|
end
|
52
52
|
|
53
|
-
it
|
54
|
-
expect
|
55
|
-
post :create, :spud_banner_set
|
56
|
-
|
53
|
+
it 'should respond unsuccessfully if the banner set is invalid' do
|
54
|
+
expect do
|
55
|
+
post :create, params: { spud_banner_set: { name: '', width: 'lorem', height: 'ipsum' } }
|
56
|
+
end.to_not change(SpudBannerSet, :count)
|
57
57
|
assert_response 422
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
61
|
describe 'edit' do
|
62
|
-
it
|
62
|
+
it 'should respond with a banner set' do
|
63
63
|
banner_set = FactoryGirl.create(:spud_banner_set)
|
64
|
-
get :edit, :id
|
64
|
+
get :edit, params: { id: banner_set.id }
|
65
65
|
expect(assigns(:banner_set)).to eq(banner_set)
|
66
66
|
expect(response).to be_success
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
70
|
describe 'update' do
|
71
|
-
it
|
71
|
+
it 'should update the banner set' do
|
72
72
|
banner_set = FactoryGirl.create(:spud_banner_set)
|
73
|
-
new_name =
|
74
|
-
expect
|
75
|
-
put :update, :id
|
73
|
+
new_name = 'Updated Set Name'
|
74
|
+
expect do
|
75
|
+
put :update, params: { id: banner_set.id, spud_banner_set: { name: new_name } }
|
76
76
|
banner_set.reload
|
77
|
-
|
77
|
+
end.to change(banner_set, :name).to(new_name)
|
78
78
|
end
|
79
79
|
|
80
|
-
it
|
80
|
+
it 'should respond unsuccessfully if the updated banner set is invalid' do
|
81
81
|
banner_set = FactoryGirl.create(:spud_banner_set)
|
82
|
-
expect
|
83
|
-
put :update, :id
|
84
|
-
|
82
|
+
expect do
|
83
|
+
put :update, params: { id: banner_set.id, spud_banner_set: { name: '', width: 'lorem', height: 'ipsum' } }
|
84
|
+
end.to_not change(SpudBannerSet, :count)
|
85
85
|
assert_response 422
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
89
|
describe 'destroy' do
|
90
|
-
it
|
90
|
+
it 'should destroy the banner set and respond successfully' do
|
91
91
|
banner_set = FactoryGirl.create(:spud_banner_set)
|
92
|
-
expect
|
93
|
-
delete :destroy, :id
|
94
|
-
|
92
|
+
expect do
|
93
|
+
delete :destroy, params: { id: banner_set.id }
|
94
|
+
end.to change(SpudBannerSet, :count).by(-1)
|
95
95
|
expect(response).to be_success
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
-
end
|
99
|
+
end
|
@@ -3,7 +3,7 @@ require File.expand_path('../boot', __FILE__)
|
|
3
3
|
require 'rails/all'
|
4
4
|
|
5
5
|
Bundler.require
|
6
|
-
require
|
6
|
+
require 'tb_banners'
|
7
7
|
|
8
8
|
module Dummy
|
9
9
|
class Application < Rails::Application
|
@@ -31,7 +31,7 @@ module Dummy
|
|
31
31
|
config.i18n.enforce_available_locales = true
|
32
32
|
|
33
33
|
# Configure the default encoding used in templates for Ruby 1.9.
|
34
|
-
config.encoding =
|
34
|
+
config.encoding = 'utf-8'
|
35
35
|
|
36
36
|
# Configure sensitive parameters which will be filtered from the log file.
|
37
37
|
config.filter_parameters += [:password]
|
@@ -51,4 +51,3 @@ module Dummy
|
|
51
51
|
config.assets.version = '1.0'
|
52
52
|
end
|
53
53
|
end
|
54
|
-
|
data/spec/dummy/config/boot.rb
CHANGED
@@ -9,7 +9,7 @@ Dummy::Application.configure do
|
|
9
9
|
config.action_controller.perform_caching = true
|
10
10
|
|
11
11
|
# Disable Rails's static asset server (Apache or nginx will already do this)
|
12
|
-
config.
|
12
|
+
config.public_file_server.enabled = false
|
13
13
|
|
14
14
|
# Compress JavaScripts and CSS
|
15
15
|
config.assets.compress = true
|
@@ -8,8 +8,8 @@ Dummy::Application.configure do
|
|
8
8
|
config.cache_classes = true
|
9
9
|
|
10
10
|
# Configure static asset server for tests with Cache-Control for performance
|
11
|
-
config.
|
12
|
-
config.
|
11
|
+
config.public_file_server.enabled = true
|
12
|
+
config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
|
13
13
|
|
14
14
|
# Deprecated
|
15
15
|
# Log error messages when you accidentally call methods on nil
|
@@ -20,7 +20,6 @@ Dummy::Application.configure do
|
|
20
20
|
# preloads Rails for running tests, you may have to set it to true.
|
21
21
|
config.eager_load = false
|
22
22
|
|
23
|
-
|
24
23
|
# Show full error reports and disable caching
|
25
24
|
config.consider_all_requests_local = true
|
26
25
|
config.action_controller.perform_caching = false
|
@@ -29,7 +28,7 @@ Dummy::Application.configure do
|
|
29
28
|
config.action_dispatch.show_exceptions = false
|
30
29
|
|
31
30
|
# Disable request forgery protection in test environment
|
32
|
-
config.action_controller.allow_forgery_protection
|
31
|
+
config.action_controller.allow_forgery_protection = false
|
33
32
|
|
34
33
|
# Tell Action Mailer not to deliver emails to the real world.
|
35
34
|
# The :test delivery method accumulates sent emails in the
|
@@ -42,6 +41,4 @@ Dummy::Application.configure do
|
|
42
41
|
|
43
42
|
# Print deprecation notices to the stderr
|
44
43
|
config.active_support.deprecation = :stderr
|
45
|
-
|
46
|
-
config.active_record.raise_in_transactional_callbacks = true
|
47
44
|
end
|
data/spec/dummy/config.ru
CHANGED
@@ -2,21 +2,21 @@
|
|
2
2
|
class CreateSpudUsers < ActiveRecord::Migration
|
3
3
|
def change
|
4
4
|
create_table :spud_users do |t|
|
5
|
-
|
5
|
+
|
6
6
|
t.string :first_name
|
7
7
|
t.string :last_name
|
8
8
|
t.boolean :super_admin
|
9
|
-
t.string :login, :
|
10
|
-
t.string :email, :
|
11
|
-
t.string :crypted_password, :
|
12
|
-
t.string :password_salt, :
|
13
|
-
t.string :persistence_token, :
|
14
|
-
t.string :single_access_token, :
|
15
|
-
t.string :perishable_token, :
|
9
|
+
t.string :login, null: false # optional, you can use email instead, or both
|
10
|
+
t.string :email, null: false # optional, you can use login instead, or both
|
11
|
+
t.string :crypted_password, null: false # optional, see below
|
12
|
+
t.string :password_salt, null: false # optional, but highly recommended
|
13
|
+
t.string :persistence_token, null: false # required
|
14
|
+
t.string :single_access_token, null: false # optional, see Authlogic::Session::Params
|
15
|
+
t.string :perishable_token, null: false # optional, see Authlogic::Session::Perishability
|
16
16
|
|
17
17
|
# Magic columns, just like ActiveRecord's created_at and updated_at. These are automatically maintained by Authlogic if they are present.
|
18
|
-
t.integer :login_count, :
|
19
|
-
t.integer :failed_login_count, :
|
18
|
+
t.integer :login_count, null: false, default: 0 # optional, see Authlogic::Session::MagicColumns
|
19
|
+
t.integer :failed_login_count, null: false, default: 0 # optional, see Authlogic::Session::MagicColumns
|
20
20
|
t.datetime :last_request_at # optional, see Authlogic::Session::MagicColumns
|
21
21
|
t.datetime :current_login_at # optional, see Authlogic::Session::MagicColumns
|
22
22
|
t.datetime :last_login_at # optional, see Authlogic::Session::MagicColumns
|
@@ -24,7 +24,7 @@ class CreateSpudUsers < ActiveRecord::Migration
|
|
24
24
|
t.string :last_login_ip # optional, see Authlogic::Session::MagicColumns
|
25
25
|
t.timestamps
|
26
26
|
end
|
27
|
-
add_index :spud_users
|
28
|
-
add_index :spud_users
|
27
|
+
add_index :spud_users, :login
|
28
|
+
add_index :spud_users, :email
|
29
29
|
end
|
30
30
|
end
|
@@ -2,10 +2,10 @@
|
|
2
2
|
class CreateSpudPermissions < ActiveRecord::Migration
|
3
3
|
def change
|
4
4
|
create_table :spud_permissions do |t|
|
5
|
-
t.string :name, :
|
6
|
-
t.string :tag, :
|
5
|
+
t.string :name, null: false
|
6
|
+
t.string :tag, null: false
|
7
7
|
t.timestamps
|
8
8
|
end
|
9
|
-
add_index :spud_permissions, :tag, :
|
9
|
+
add_index :spud_permissions, :tag, unique: true
|
10
10
|
end
|
11
11
|
end
|
@@ -2,8 +2,8 @@
|
|
2
2
|
class CreateSpudRolePermissions < ActiveRecord::Migration
|
3
3
|
def change
|
4
4
|
create_table :spud_role_permissions do |t|
|
5
|
-
t.integer :spud_role_id, :
|
6
|
-
t.string :spud_permission_tag, :
|
5
|
+
t.integer :spud_role_id, null: false
|
6
|
+
t.string :spud_permission_tag, null: false
|
7
7
|
t.timestamps
|
8
8
|
end
|
9
9
|
add_index :spud_role_permissions, :spud_role_id
|
@@ -2,15 +2,15 @@
|
|
2
2
|
class CreateSpudBanners < ActiveRecord::Migration
|
3
3
|
def change
|
4
4
|
create_table :spud_banners do |t|
|
5
|
-
t.integer :spud_banner_set_id, :
|
5
|
+
t.integer :spud_banner_set_id, null: false
|
6
6
|
t.string :link_to
|
7
|
-
t.string :link_target, :
|
7
|
+
t.string :link_target, default: '_self'
|
8
8
|
t.string :title
|
9
9
|
t.string :alt
|
10
|
-
t.integer :sort_order, :
|
10
|
+
t.integer :sort_order, default: 0
|
11
11
|
t.attachment :banner
|
12
12
|
t.timestamps
|
13
13
|
end
|
14
|
-
add_index :spud_banners, :spud_banner_set_id, :
|
14
|
+
add_index :spud_banners, :spud_banner_set_id, unique: false
|
15
15
|
end
|
16
16
|
end
|
@@ -2,12 +2,12 @@
|
|
2
2
|
class CreateSpudBannerSets < ActiveRecord::Migration
|
3
3
|
def change
|
4
4
|
create_table :spud_banner_sets do |t|
|
5
|
-
t.string :name, :
|
6
|
-
t.integer :width, :
|
7
|
-
t.integer :height, :
|
8
|
-
t.boolean :cropped, :
|
5
|
+
t.string :name, null: false
|
6
|
+
t.integer :width, null: false
|
7
|
+
t.integer :height, null: false
|
8
|
+
t.boolean :cropped, default: true
|
9
9
|
t.timestamps
|
10
10
|
end
|
11
|
-
add_index :spud_banner_sets, :name, :
|
11
|
+
add_index :spud_banner_sets, :name, unique: true
|
12
12
|
end
|
13
13
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# This migration comes from tb_banners (originally 20130614132846)
|
2
2
|
class AddRichTextToSpudBanners < ActiveRecord::Migration
|
3
3
|
def change
|
4
|
-
add_column :spud_banner_sets, :has_rich_text, :boolean, :
|
4
|
+
add_column :spud_banner_sets, :has_rich_text, :boolean, default: false
|
5
5
|
add_column :spud_banners, :rich_text, :text
|
6
6
|
end
|
7
7
|
end
|
data/spec/dummy/db/migrate/20160310164644_add_requires_password_change_to_spud_users.tb_core.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This migration comes from tb_core (originally 20150610143438)
|
2
2
|
class AddRequiresPasswordChangeToSpudUsers < ActiveRecord::Migration
|
3
3
|
def change
|
4
|
-
add_column :spud_users, :requires_password_change, :boolean, :
|
4
|
+
add_column :spud_users, :requires_password_change, :boolean, default: false
|
5
5
|
end
|
6
6
|
end
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: UTF-8
|
2
1
|
# This file is auto-generated from the current state of the database. Instead
|
3
2
|
# of editing this file, please use the migrations feature of Active Record to
|
4
3
|
# incrementally modify your database, and then regenerate this schema definition.
|
@@ -11,111 +10,105 @@
|
|
11
10
|
#
|
12
11
|
# It's strongly recommended that you check this file into your version control system.
|
13
12
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
15
|
-
|
16
|
-
create_table
|
17
|
-
t.string
|
18
|
-
t.integer
|
19
|
-
t.integer
|
20
|
-
t.boolean
|
21
|
-
t.datetime
|
22
|
-
t.datetime
|
23
|
-
t.boolean
|
13
|
+
ActiveRecord::Schema.define(version: 20_160_310_164_644) do
|
14
|
+
|
15
|
+
create_table 'spud_banner_sets', force: :cascade, options: 'ENGINE=InnoDB DEFAULT CHARSET=utf8' do |t|
|
16
|
+
t.string 'name', null: false
|
17
|
+
t.integer 'width', null: false
|
18
|
+
t.integer 'height', null: false
|
19
|
+
t.boolean 'cropped', default: true
|
20
|
+
t.datetime 'created_at'
|
21
|
+
t.datetime 'updated_at'
|
22
|
+
t.boolean 'has_rich_text', default: false
|
23
|
+
t.index ['name'], name: 'index_spud_banner_sets_on_name', unique: true, using: :btree
|
24
24
|
end
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
t.
|
30
|
-
t.string
|
31
|
-
t.string
|
32
|
-
t.
|
33
|
-
t.string
|
34
|
-
t.
|
35
|
-
t.
|
36
|
-
t.
|
37
|
-
t.
|
38
|
-
t.datetime
|
39
|
-
t.
|
40
|
-
t.
|
41
|
-
t.
|
42
|
-
t.
|
43
|
-
t.date "end_date"
|
26
|
+
create_table 'spud_banners', force: :cascade, options: 'ENGINE=InnoDB DEFAULT CHARSET=utf8' do |t|
|
27
|
+
t.integer 'spud_banner_set_id', null: false
|
28
|
+
t.string 'link_to'
|
29
|
+
t.string 'link_target', default: '_self'
|
30
|
+
t.string 'title'
|
31
|
+
t.string 'alt'
|
32
|
+
t.integer 'sort_order', default: 0
|
33
|
+
t.string 'banner_file_name'
|
34
|
+
t.string 'banner_content_type'
|
35
|
+
t.integer 'banner_file_size'
|
36
|
+
t.datetime 'banner_updated_at'
|
37
|
+
t.datetime 'created_at'
|
38
|
+
t.datetime 'updated_at'
|
39
|
+
t.text 'rich_text', limit: 65_535
|
40
|
+
t.date 'start_date'
|
41
|
+
t.date 'end_date'
|
42
|
+
t.index ['spud_banner_set_id'], name: 'index_spud_banners_on_spud_banner_set_id', using: :btree
|
44
43
|
end
|
45
44
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
t.
|
50
|
-
t.string
|
51
|
-
t.
|
52
|
-
t.
|
53
|
-
t.
|
54
|
-
t.datetime "updated_at"
|
45
|
+
create_table 'spud_liquid_tags', force: :cascade, options: 'ENGINE=InnoDB DEFAULT CHARSET=utf8' do |t|
|
46
|
+
t.integer 'attachment_id'
|
47
|
+
t.string 'attachment_type'
|
48
|
+
t.string 'tag_name'
|
49
|
+
t.string 'value'
|
50
|
+
t.datetime 'created_at'
|
51
|
+
t.datetime 'updated_at'
|
52
|
+
t.index ['tag_name', 'value'], name: 'index_spud_liquid_tags_on_tag_name_and_value', using: :btree
|
55
53
|
end
|
56
54
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
t.
|
61
|
-
t.
|
62
|
-
t.
|
63
|
-
t.datetime "updated_at"
|
55
|
+
create_table 'spud_permissions', force: :cascade, options: 'ENGINE=InnoDB DEFAULT CHARSET=utf8' do |t|
|
56
|
+
t.string 'name', null: false
|
57
|
+
t.string 'tag', null: false
|
58
|
+
t.datetime 'created_at'
|
59
|
+
t.datetime 'updated_at'
|
60
|
+
t.index ['tag'], name: 'index_spud_permissions_on_tag', unique: true, using: :btree
|
64
61
|
end
|
65
62
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
t.
|
70
|
-
t.
|
71
|
-
t.
|
72
|
-
t.
|
63
|
+
create_table 'spud_role_permissions', force: :cascade, options: 'ENGINE=InnoDB DEFAULT CHARSET=utf8' do |t|
|
64
|
+
t.integer 'spud_role_id', null: false
|
65
|
+
t.string 'spud_permission_tag', null: false
|
66
|
+
t.datetime 'created_at'
|
67
|
+
t.datetime 'updated_at'
|
68
|
+
t.index ['spud_permission_tag'], name: 'index_spud_role_permissions_on_spud_permission_tag', using: :btree
|
69
|
+
t.index ['spud_role_id'], name: 'index_spud_role_permissions_on_spud_role_id', using: :btree
|
73
70
|
end
|
74
71
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
t.string "name", limit: 255
|
80
|
-
t.datetime "created_at"
|
81
|
-
t.datetime "updated_at"
|
72
|
+
create_table 'spud_roles', force: :cascade, options: 'ENGINE=InnoDB DEFAULT CHARSET=utf8' do |t|
|
73
|
+
t.string 'name'
|
74
|
+
t.datetime 'created_at'
|
75
|
+
t.datetime 'updated_at'
|
82
76
|
end
|
83
77
|
|
84
|
-
create_table
|
85
|
-
t.integer
|
86
|
-
t.string
|
87
|
-
t.string
|
88
|
-
t.datetime
|
89
|
-
t.datetime
|
78
|
+
create_table 'spud_user_settings', force: :cascade, options: 'ENGINE=InnoDB DEFAULT CHARSET=utf8' do |t|
|
79
|
+
t.integer 'spud_user_id'
|
80
|
+
t.string 'key'
|
81
|
+
t.string 'value'
|
82
|
+
t.datetime 'created_at'
|
83
|
+
t.datetime 'updated_at'
|
90
84
|
end
|
91
85
|
|
92
|
-
create_table
|
93
|
-
t.string
|
94
|
-
t.string
|
95
|
-
t.boolean
|
96
|
-
t.string
|
97
|
-
t.string
|
98
|
-
t.string
|
99
|
-
t.string
|
100
|
-
t.string
|
101
|
-
t.string
|
102
|
-
t.string
|
103
|
-
t.integer
|
104
|
-
t.integer
|
105
|
-
t.datetime
|
106
|
-
t.datetime
|
107
|
-
t.datetime
|
108
|
-
t.string
|
109
|
-
t.string
|
110
|
-
t.datetime
|
111
|
-
t.datetime
|
112
|
-
t.string
|
113
|
-
t.integer
|
114
|
-
t.boolean
|
86
|
+
create_table 'spud_users', force: :cascade, options: 'ENGINE=InnoDB DEFAULT CHARSET=utf8' do |t|
|
87
|
+
t.string 'first_name'
|
88
|
+
t.string 'last_name'
|
89
|
+
t.boolean 'super_admin'
|
90
|
+
t.string 'login', null: false
|
91
|
+
t.string 'email', null: false
|
92
|
+
t.string 'crypted_password', null: false
|
93
|
+
t.string 'password_salt', null: false
|
94
|
+
t.string 'persistence_token', null: false
|
95
|
+
t.string 'single_access_token', null: false
|
96
|
+
t.string 'perishable_token', null: false
|
97
|
+
t.integer 'login_count', default: 0, null: false
|
98
|
+
t.integer 'failed_login_count', default: 0, null: false
|
99
|
+
t.datetime 'last_request_at'
|
100
|
+
t.datetime 'current_login_at'
|
101
|
+
t.datetime 'last_login_at'
|
102
|
+
t.string 'current_login_ip'
|
103
|
+
t.string 'last_login_ip'
|
104
|
+
t.datetime 'created_at'
|
105
|
+
t.datetime 'updated_at'
|
106
|
+
t.string 'time_zone'
|
107
|
+
t.integer 'spud_role_id'
|
108
|
+
t.boolean 'requires_password_change', default: false
|
109
|
+
t.index ['email'], name: 'index_spud_users_on_email', using: :btree
|
110
|
+
t.index ['login'], name: 'index_spud_users_on_login', using: :btree
|
111
|
+
t.index ['spud_role_id'], name: 'index_spud_users_on_spud_role_id', using: :btree
|
115
112
|
end
|
116
113
|
|
117
|
-
add_index "spud_users", ["email"], name: "index_spud_users_on_email", using: :btree
|
118
|
-
add_index "spud_users", ["login"], name: "index_spud_users_on_login", using: :btree
|
119
|
-
add_index "spud_users", ["spud_role_id"], name: "index_spud_users_on_spud_role_id", using: :btree
|
120
|
-
|
121
114
|
end
|
data/spec/dummy/script/rails
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
3
|
|
4
|
-
APP_PATH = File.expand_path('../../config/application',
|
5
|
-
require File.expand_path('../../config/boot',
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
6
|
require 'rails/commands'
|
data/spec/rails_helper.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
-
ENV[
|
2
|
+
ENV['RAILS_ENV'] ||= 'test'
|
3
3
|
|
4
|
-
require File.expand_path(
|
4
|
+
require File.expand_path('../dummy/config/environment.rb', __FILE__)
|
5
5
|
require 'spec_helper'
|
6
6
|
require 'authlogic_helper'
|
7
7
|
require 'rspec/rails'
|
8
|
+
require 'rails-controller-testing'
|
8
9
|
require 'database_cleaner'
|
9
10
|
require 'simplecov'
|
10
11
|
require 'factory_girl_rails'
|
@@ -30,12 +31,18 @@ SimpleCov.start 'rails'
|
|
30
31
|
|
31
32
|
# Checks for pending migrations before tests are run.
|
32
33
|
# If you are not using ActiveRecord, you can remove this line.
|
33
|
-
#ActiveRecord::Migration.maintain_test_schema!
|
34
|
+
# ActiveRecord::Migration.maintain_test_schema!
|
34
35
|
|
35
36
|
RSpec.configure do |config|
|
37
|
+
[:controller, :view, :request].each do |type|
|
38
|
+
config.include ::Rails::Controller::Testing::TestProcess, type: type
|
39
|
+
config.include ::Rails::Controller::Testing::TemplateAssertions, type: type
|
40
|
+
config.include ::Rails::Controller::Testing::Integration, type: type
|
41
|
+
end
|
42
|
+
|
36
43
|
config.raise_errors_for_deprecations!
|
37
44
|
config.infer_base_class_for_anonymous_controllers = false
|
38
|
-
|
45
|
+
|
39
46
|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
40
47
|
# examples within a transaction, remove the following line or assign false
|
41
48
|
# instead of true.
|
@@ -67,5 +74,5 @@ RSpec.configure do |config|
|
|
67
74
|
example.run
|
68
75
|
end
|
69
76
|
end
|
70
|
-
|
77
|
+
|
71
78
|
end
|