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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.markdown +2 -12
  3. data/Rakefile +2 -5
  4. data/app/assets/javascripts/admin/banners/banners.js +34 -41
  5. data/app/controllers/admin/banner_sets_controller.rb +15 -19
  6. data/app/controllers/admin/banners_controller.rb +30 -52
  7. data/app/helpers/spud_banners_helper.rb +12 -12
  8. data/app/models/spud_banner.rb +18 -18
  9. data/app/models/spud_banner_set.rb +15 -17
  10. data/app/views/admin/banners/_form.html.erb +1 -3
  11. data/lib/spud_banners/configuration.rb +2 -2
  12. data/lib/spud_banners/engine.rb +6 -6
  13. data/lib/spud_banners/liquid_tags.rb +6 -3
  14. data/lib/spud_banners/version.rb +1 -1
  15. data/lib/tb_banners.rb +1 -1
  16. data/spec/authlogic_helper.rb +1 -1
  17. data/spec/controllers/admin/banner_sets_controller_spec.rb +33 -33
  18. data/spec/dummy/config/application.rb +2 -3
  19. data/spec/dummy/config/boot.rb +1 -1
  20. data/spec/dummy/config/environments/production.rb +1 -1
  21. data/spec/dummy/config/environments/test.rb +3 -6
  22. data/spec/dummy/config.ru +1 -1
  23. data/spec/dummy/db/migrate/20121127192247_create_spud_users.spud_core.rb +12 -12
  24. data/spec/dummy/db/migrate/20121127192248_add_time_zone_to_spud_user.spud_core.rb +0 -1
  25. data/spec/dummy/db/migrate/20121127192249_add_scope_to_spud_admin_permissions.spud_core.rb +0 -1
  26. data/spec/dummy/db/migrate/20130920154443_create_spud_permissions.tb_core.rb +3 -3
  27. data/spec/dummy/db/migrate/20130920154444_create_spud_role_permissions.tb_core.rb +2 -2
  28. data/spec/dummy/db/migrate/20130920154446_create_spud_banners.tb_banners.rb +4 -4
  29. data/spec/dummy/db/migrate/20130920154447_create_spud_banner_sets.tb_banners.rb +5 -5
  30. data/spec/dummy/db/migrate/20130920154448_add_rich_text_to_spud_banners.tb_banners.rb +1 -1
  31. data/spec/dummy/db/migrate/20160310164644_add_requires_password_change_to_spud_users.tb_core.rb +1 -1
  32. data/spec/dummy/db/schema.rb +85 -92
  33. data/spec/dummy/script/rails +2 -2
  34. data/spec/rails_helper.rb +12 -5
  35. data/spec/spec_helper.rb +42 -44
  36. metadata +72 -31
  37. 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, :type => 'controller' do
3
+ describe Admin::BannerSetsController, type: 'controller' do
4
4
 
5
5
  before(:each) do
6
6
  activate_authlogic
7
- u = SpudUser.new(:login => "testuser",:email => "test@testuser.com",:password => "test",:password_confirmation => "test")
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 "should return an array of banner sets" do
15
- 5.times do |x|
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 "should respond with a banner set" do
24
+ it 'should respond with a banner set' do
25
25
  banner_set = FactoryGirl.create(:spud_banner_set)
26
- get :show, :id => banner_set.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 "should redirect if banner set is not found" do
32
- get :show, :id => -1
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 "should respond with a banner set" do
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 "should respond with a banner set" do
47
- expect {
48
- post :create, :spud_banner_set => FactoryGirl.attributes_for(:spud_banner_set)
49
- }.to change(SpudBannerSet, :count).by(1)
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 "should respond unsuccessfully if the banner set is invalid" do
54
- expect {
55
- post :create, :spud_banner_set => {:name => '', :width => 'lorem', :height => 'ipsum'}
56
- }.to_not change(SpudBannerSet, :count)
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 "should respond with a banner set" do
62
+ it 'should respond with a banner set' do
63
63
  banner_set = FactoryGirl.create(:spud_banner_set)
64
- get :edit, :id => banner_set.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 "should update the banner set" do
71
+ it 'should update the banner set' do
72
72
  banner_set = FactoryGirl.create(:spud_banner_set)
73
- new_name = "Updated Set Name"
74
- expect {
75
- put :update, :id => banner_set.id, :spud_banner_set => {:name => new_name}
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
- }.to change(banner_set, :name).to(new_name)
77
+ end.to change(banner_set, :name).to(new_name)
78
78
  end
79
79
 
80
- it "should respond unsuccessfully if the updated banner set is invalid" do
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 => banner_set.id, :spud_banner_set => {:name => '', :width => 'lorem', :height => 'ipsum'}
84
- }.to_not change(SpudBannerSet, :count)
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 "should destroy the banner set and respond successfully" do
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 => banner_set.id
94
- }.to change(SpudBannerSet, :count).by(-1)
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 "tb_banners"
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 = "utf-8"
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
-
@@ -7,4 +7,4 @@ if File.exist?(gemfile)
7
7
  Bundler.setup
8
8
  end
9
9
 
10
- $:.unshift File.expand_path('../../../../lib', __FILE__)
10
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -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.serve_static_files = false
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.serve_static_files = true
12
- config.static_cache_control = "public, max-age=3600"
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 = false
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
@@ -1,4 +1,4 @@
1
1
  # This file is used by Rack-based servers to start the application.
2
2
 
3
- require ::File.expand_path('../config/environment', __FILE__)
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
4
  run Dummy::Application
@@ -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, :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
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, :null => false, :default => 0 # optional, see Authlogic::Session::MagicColumns
19
- t.integer :failed_login_count, :null => false, :default => 0 # optional, see Authlogic::Session::MagicColumns
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,:login
28
- add_index :spud_users,:email
27
+ add_index :spud_users, :login
28
+ add_index :spud_users, :email
29
29
  end
30
30
  end
@@ -2,6 +2,5 @@
2
2
  class AddTimeZoneToSpudUser < ActiveRecord::Migration
3
3
  def change
4
4
  add_column :spud_users, :time_zone, :string
5
-
6
5
  end
7
6
  end
@@ -2,6 +2,5 @@
2
2
  class AddScopeToSpudAdminPermissions < ActiveRecord::Migration
3
3
  def change
4
4
  add_column :spud_admin_permissions, :scope, :string
5
-
6
5
  end
7
6
  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, :null => false
6
- t.string :tag, :null => false
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, :unique => true
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, :null => false
6
- t.string :spud_permission_tag, :null => false
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, :null => false
5
+ t.integer :spud_banner_set_id, null: false
6
6
  t.string :link_to
7
- t.string :link_target, :default => '_self'
7
+ t.string :link_target, default: '_self'
8
8
  t.string :title
9
9
  t.string :alt
10
- t.integer :sort_order, :default => 0
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, :unique => false
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, :null => false
6
- t.integer :width, :null => false
7
- t.integer :height, :null => false
8
- t.boolean :cropped, :default => true
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, :unique => true
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, :default => false
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
@@ -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, :default => false
4
+ add_column :spud_users, :requires_password_change, :boolean, default: false
5
5
  end
6
6
  end
@@ -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: 20160310164644) do
15
-
16
- create_table "spud_banner_sets", force: :cascade do |t|
17
- t.string "name", limit: 255, null: false
18
- t.integer "width", limit: 4, null: false
19
- t.integer "height", limit: 4, null: false
20
- t.boolean "cropped", default: true
21
- t.datetime "created_at"
22
- t.datetime "updated_at"
23
- t.boolean "has_rich_text", default: false
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
- add_index "spud_banner_sets", ["name"], name: "index_spud_banner_sets_on_name", unique: true, using: :btree
27
-
28
- create_table "spud_banners", force: :cascade do |t|
29
- t.integer "spud_banner_set_id", limit: 4, null: false
30
- t.string "link_to", limit: 255
31
- t.string "link_target", limit: 255, default: "_self"
32
- t.string "title", limit: 255
33
- t.string "alt", limit: 255
34
- t.integer "sort_order", limit: 4, default: 0
35
- t.string "banner_file_name", limit: 255
36
- t.string "banner_content_type", limit: 255
37
- t.integer "banner_file_size", limit: 4
38
- t.datetime "banner_updated_at"
39
- t.datetime "created_at"
40
- t.datetime "updated_at"
41
- t.text "rich_text", limit: 65535
42
- t.date "start_date"
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
- add_index "spud_banners", ["spud_banner_set_id"], name: "index_spud_banners_on_spud_banner_set_id", using: :btree
47
-
48
- create_table "spud_liquid_tags", force: :cascade do |t|
49
- t.integer "attachment_id", limit: 4
50
- t.string "attachment_type", limit: 255
51
- t.string "tag_name", limit: 255
52
- t.string "value", limit: 255
53
- t.datetime "created_at"
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
- add_index "spud_liquid_tags", ["tag_name", "value"], name: "index_spud_liquid_tags_on_tag_name_and_value", using: :btree
58
-
59
- create_table "spud_permissions", force: :cascade do |t|
60
- t.string "name", limit: 255, null: false
61
- t.string "tag", limit: 255, null: false
62
- t.datetime "created_at"
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
- add_index "spud_permissions", ["tag"], name: "index_spud_permissions_on_tag", unique: true, using: :btree
67
-
68
- create_table "spud_role_permissions", force: :cascade do |t|
69
- t.integer "spud_role_id", limit: 4, null: false
70
- t.string "spud_permission_tag", limit: 255, null: false
71
- t.datetime "created_at"
72
- t.datetime "updated_at"
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
- add_index "spud_role_permissions", ["spud_permission_tag"], name: "index_spud_role_permissions_on_spud_permission_tag", using: :btree
76
- add_index "spud_role_permissions", ["spud_role_id"], name: "index_spud_role_permissions_on_spud_role_id", using: :btree
77
-
78
- create_table "spud_roles", force: :cascade do |t|
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 "spud_user_settings", force: :cascade do |t|
85
- t.integer "spud_user_id", limit: 4
86
- t.string "key", limit: 255
87
- t.string "value", limit: 255
88
- t.datetime "created_at"
89
- t.datetime "updated_at"
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 "spud_users", force: :cascade do |t|
93
- t.string "first_name", limit: 255
94
- t.string "last_name", limit: 255
95
- t.boolean "super_admin"
96
- t.string "login", limit: 255, null: false
97
- t.string "email", limit: 255, null: false
98
- t.string "crypted_password", limit: 255, null: false
99
- t.string "password_salt", limit: 255, null: false
100
- t.string "persistence_token", limit: 255, null: false
101
- t.string "single_access_token", limit: 255, null: false
102
- t.string "perishable_token", limit: 255, null: false
103
- t.integer "login_count", limit: 4, default: 0, null: false
104
- t.integer "failed_login_count", limit: 4, default: 0, null: false
105
- t.datetime "last_request_at"
106
- t.datetime "current_login_at"
107
- t.datetime "last_login_at"
108
- t.string "current_login_ip", limit: 255
109
- t.string "last_login_ip", limit: 255
110
- t.datetime "created_at"
111
- t.datetime "updated_at"
112
- t.string "time_zone", limit: 255
113
- t.integer "spud_role_id", limit: 4
114
- t.boolean "requires_password_change", default: false
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
@@ -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', __FILE__)
5
- require File.expand_path('../../config/boot', __FILE__)
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["RAILS_ENV"] ||= 'test'
2
+ ENV['RAILS_ENV'] ||= 'test'
3
3
 
4
- require File.expand_path("../dummy/config/environment.rb", __FILE__)
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