tb_banners 1.2.0.beta1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +5 -5
  2. data/README.markdown +9 -14
  3. data/Rakefile +2 -5
  4. data/app/assets/javascripts/admin/banners/banner_sets.js +4 -1
  5. data/app/assets/javascripts/admin/banners/banners.js +49 -56
  6. data/app/assets/stylesheets/admin/banners/banners.css.scss +6 -1
  7. data/app/controllers/admin/banner_sets_controller.rb +15 -23
  8. data/app/controllers/admin/banners_controller.rb +32 -61
  9. data/app/helpers/spud_banners_helper.rb +24 -19
  10. data/app/models/spud_banner.rb +33 -20
  11. data/app/models/spud_banner_set.rb +16 -19
  12. data/app/views/admin/banner_sets/index.html.erb +1 -1
  13. data/app/views/admin/banner_sets/show.html.erb +2 -1
  14. data/app/views/admin/banners/_banner.html.erb +4 -1
  15. data/app/views/admin/banners/_form.html.erb +3 -5
  16. data/db/migrate/20121116195139_create_spud_banners.rb +1 -1
  17. data/db/migrate/20121116195312_create_spud_banner_sets.rb +1 -1
  18. data/db/migrate/20130614132846_add_rich_text_to_spud_banners.rb +1 -1
  19. data/db/migrate/20140721142719_add_start_and_end_dates_to_spud_banners.rb +1 -1
  20. data/lib/spud_banners/configuration.rb +6 -5
  21. data/lib/spud_banners/engine.rb +13 -11
  22. data/lib/spud_banners/version.rb +1 -1
  23. data/lib/tb_banners.rb +1 -2
  24. data/spec/controllers/admin/banner_sets_controller_spec.rb +57 -58
  25. data/spec/dummy/config.ru +1 -1
  26. data/spec/dummy/config/application.rb +2 -3
  27. data/spec/dummy/config/boot.rb +1 -1
  28. data/spec/dummy/config/environments/production.rb +1 -1
  29. data/spec/dummy/config/environments/test.rb +3 -4
  30. data/spec/dummy/config/initializers/secret_token.rb +0 -1
  31. data/spec/dummy/db/migrate/20121127192246_create_spud_admin_permissions.spud_core.rb +1 -1
  32. data/spec/dummy/db/migrate/20121127192247_create_spud_users.spud_core.rb +13 -13
  33. data/spec/dummy/db/migrate/20121127192248_add_time_zone_to_spud_user.spud_core.rb +1 -2
  34. data/spec/dummy/db/migrate/20121127192249_add_scope_to_spud_admin_permissions.spud_core.rb +1 -2
  35. data/spec/dummy/db/migrate/20121127192250_create_spud_user_settings.spud_core.rb +1 -1
  36. data/spec/dummy/db/migrate/20130920154442_create_spud_roles.tb_core.rb +1 -1
  37. data/spec/dummy/db/migrate/20130920154443_create_spud_permissions.tb_core.rb +4 -4
  38. data/spec/dummy/db/migrate/20130920154444_create_spud_role_permissions.tb_core.rb +3 -3
  39. data/spec/dummy/db/migrate/20130920154445_drop_spud_admin_permissions.tb_core.rb +1 -1
  40. data/spec/dummy/db/migrate/20160310164644_add_requires_password_change_to_spud_users.tb_core.rb +6 -0
  41. data/spec/dummy/db/schema.rb +70 -84
  42. data/spec/dummy/script/rails +2 -2
  43. data/spec/factories/spud_banner_sets.rb +9 -0
  44. data/spec/factories/spud_banners.rb +7 -0
  45. data/spec/models/spud_banner_spec.rb +27 -0
  46. data/spec/rails_helper.rb +81 -0
  47. data/spec/spec_helper.rb +77 -34
  48. metadata +79 -109
  49. data/app/views/admin/banners/legacy.js.erb +0 -5
  50. data/lib/spud_banners/liquid_tags.rb +0 -31
  51. data/spec/dummy/db/migrate/20130920154446_create_spud_banners.tb_banners.rb +0 -16
  52. data/spec/dummy/db/migrate/20130920154447_create_spud_banner_sets.tb_banners.rb +0 -13
  53. data/spec/dummy/db/migrate/20130920154448_add_rich_text_to_spud_banners.tb_banners.rb +0 -7
  54. data/spec/dummy/db/migrate/20140120174546_create_tb_liquid_spud_liquid_tags.tb_liquid.rb +0 -13
  55. data/spec/support/authlogic_helper.rb +0 -2
@@ -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
@@ -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_assets = 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_assets = 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
@@ -4,5 +4,4 @@
4
4
  # If you change this key, all old signed cookies will become invalid!
5
5
  # Make sure the secret is at least 30 characters and all random,
6
6
  # no regular words or you'll be exposed to dictionary attacks.
7
- Dummy::Application.config.secret_token = 'dacbd8a483ea9645b13e97018089cbc9da8bf98f99a0be873cdb565d8f64c066974f37cbe7e8b4fedaadd057bce78d1d9326b0768120d2a693de8165df286693'
8
7
  Dummy::Application.config.secret_key_base = 'b43711419c807b9c9efe9365dd79f87ebe31e9f72e1aa6744c1ecac68aace664c0a3a4f791d92bd2fa324fce1d6d09701a54b88453f131b7c460eeb9c530bd72'
@@ -1,5 +1,5 @@
1
1
  # This migration comes from spud_core (originally 20111214161011)
2
- class CreateSpudAdminPermissions < ActiveRecord::Migration
2
+ class CreateSpudAdminPermissions < ActiveRecord::Migration[4.2]
3
3
  def change
4
4
  create_table :spud_admin_permissions do |t|
5
5
  t.integer :user_id
@@ -1,22 +1,22 @@
1
1
  # This migration comes from spud_core (originally 20111214161146)
2
- class CreateSpudUsers < ActiveRecord::Migration
2
+ class CreateSpudUsers < ActiveRecord::Migration[4.2]
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
@@ -1,7 +1,6 @@
1
1
  # This migration comes from spud_core (originally 20120327124229)
2
- class AddTimeZoneToSpudUser < ActiveRecord::Migration
2
+ class AddTimeZoneToSpudUser < ActiveRecord::Migration[4.2]
3
3
  def change
4
4
  add_column :spud_users, :time_zone, :string
5
-
6
5
  end
7
6
  end
@@ -1,7 +1,6 @@
1
1
  # This migration comes from spud_core (originally 20120328235431)
2
- class AddScopeToSpudAdminPermissions < ActiveRecord::Migration
2
+ class AddScopeToSpudAdminPermissions < ActiveRecord::Migration[4.2]
3
3
  def change
4
4
  add_column :spud_admin_permissions, :scope, :string
5
-
6
5
  end
7
6
  end
@@ -1,5 +1,5 @@
1
1
  # This migration comes from spud_core (originally 20120329174000)
2
- class CreateSpudUserSettings < ActiveRecord::Migration
2
+ class CreateSpudUserSettings < ActiveRecord::Migration[4.2]
3
3
  def change
4
4
  create_table :spud_user_settings do |t|
5
5
  t.integer :spud_user_id
@@ -1,5 +1,5 @@
1
1
  # This migration comes from tb_core (originally 20130620143010)
2
- class CreateSpudRoles < ActiveRecord::Migration
2
+ class CreateSpudRoles < ActiveRecord::Migration[4.2]
3
3
  def change
4
4
  create_table :spud_roles do |t|
5
5
  t.string :name
@@ -1,11 +1,11 @@
1
1
  # This migration comes from tb_core (originally 20130620143941)
2
- class CreateSpudPermissions < ActiveRecord::Migration
2
+ class CreateSpudPermissions < ActiveRecord::Migration[4.2]
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
@@ -1,9 +1,9 @@
1
1
  # This migration comes from tb_core (originally 20130620151132)
2
- class CreateSpudRolePermissions < ActiveRecord::Migration
2
+ class CreateSpudRolePermissions < ActiveRecord::Migration[4.2]
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
@@ -1,5 +1,5 @@
1
1
  # This migration comes from tb_core (originally 20130620163144)
2
- class DropSpudAdminPermissions < ActiveRecord::Migration
2
+ class DropSpudAdminPermissions < ActiveRecord::Migration[4.2]
3
3
  def up
4
4
  drop_table :spud_admin_permissions
5
5
  end
@@ -0,0 +1,6 @@
1
+ # This migration comes from tb_core (originally 20150610143438)
2
+ class AddRequiresPasswordChangeToSpudUsers < ActiveRecord::Migration[4.2]
3
+ def change
4
+ add_column :spud_users, :requires_password_change, :boolean, default: false
5
+ end
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,108 +10,95 @@
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: 20140120174546) do
13
+ ActiveRecord::Schema.define(version: 20160310164644) do
15
14
 
16
- create_table "spud_banner_sets", force: true do |t|
17
- t.string "name", null: false
18
- t.integer "width", null: false
19
- t.integer "height", null: false
20
- t.boolean "cropped", default: true
21
- t.datetime "created_at", null: false
22
- t.datetime "updated_at", null: false
23
- t.boolean "has_rich_text", default: false
15
+ create_table "spud_banner_sets", id: :integer, 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
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: true do |t|
29
- t.integer "spud_banner_set_id", null: false
30
- t.string "link_to"
31
- t.string "link_target", default: "_self"
32
- t.string "title"
33
- t.string "alt"
34
- t.integer "sort_order", default: 0
35
- t.string "banner_file_name"
36
- t.string "banner_content_type"
37
- t.integer "banner_file_size"
26
+ create_table "spud_banners", id: :integer, 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"
38
36
  t.datetime "banner_updated_at"
39
- t.datetime "created_at", null: false
40
- t.datetime "updated_at", null: false
41
- t.text "rich_text"
42
- end
43
-
44
- add_index "spud_banners", ["spud_banner_set_id"], name: "index_spud_banners_on_spud_banner_set_id", using: :btree
45
-
46
- create_table "spud_liquid_tags", force: true do |t|
47
- t.integer "attachment_id"
48
- t.string "attachment_type"
49
- t.string "tag_name"
50
- t.string "value"
51
37
  t.datetime "created_at"
52
38
  t.datetime "updated_at"
39
+ t.text "rich_text"
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"
53
43
  end
54
44
 
55
- add_index "spud_liquid_tags", ["tag_name", "value"], name: "index_spud_liquid_tags_on_tag_name_and_value", using: :btree
56
-
57
- create_table "spud_permissions", force: true do |t|
58
- t.string "name", null: false
59
- t.string "tag", null: false
60
- t.datetime "created_at", null: false
61
- t.datetime "updated_at", null: false
45
+ create_table "spud_permissions", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
46
+ t.string "name", null: false
47
+ t.string "tag", null: false
48
+ t.datetime "created_at"
49
+ t.datetime "updated_at"
50
+ t.index ["tag"], name: "index_spud_permissions_on_tag", unique: true
62
51
  end
63
52
 
64
- add_index "spud_permissions", ["tag"], name: "index_spud_permissions_on_tag", unique: true, using: :btree
65
-
66
- create_table "spud_role_permissions", force: true do |t|
67
- t.integer "spud_role_id", null: false
68
- t.string "spud_permission_tag", null: false
69
- t.datetime "created_at", null: false
70
- t.datetime "updated_at", null: false
53
+ create_table "spud_role_permissions", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
54
+ t.integer "spud_role_id", null: false
55
+ t.string "spud_permission_tag", null: false
56
+ t.datetime "created_at"
57
+ t.datetime "updated_at"
58
+ t.index ["spud_permission_tag"], name: "index_spud_role_permissions_on_spud_permission_tag"
59
+ t.index ["spud_role_id"], name: "index_spud_role_permissions_on_spud_role_id"
71
60
  end
72
61
 
73
- add_index "spud_role_permissions", ["spud_permission_tag"], name: "index_spud_role_permissions_on_spud_permission_tag", using: :btree
74
- add_index "spud_role_permissions", ["spud_role_id"], name: "index_spud_role_permissions_on_spud_role_id", using: :btree
75
-
76
- create_table "spud_roles", force: true do |t|
77
- t.string "name"
78
- t.datetime "created_at", null: false
79
- t.datetime "updated_at", null: false
62
+ create_table "spud_roles", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
63
+ t.string "name"
64
+ t.datetime "created_at"
65
+ t.datetime "updated_at"
80
66
  end
81
67
 
82
- create_table "spud_user_settings", force: true do |t|
83
- t.integer "spud_user_id"
84
- t.string "key"
85
- t.string "value"
86
- t.datetime "created_at", null: false
87
- t.datetime "updated_at", null: false
68
+ create_table "spud_user_settings", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
69
+ t.integer "spud_user_id"
70
+ t.string "key"
71
+ t.string "value"
72
+ t.datetime "created_at"
73
+ t.datetime "updated_at"
88
74
  end
89
75
 
90
- create_table "spud_users", force: true do |t|
91
- t.string "first_name"
92
- t.string "last_name"
93
- t.boolean "super_admin"
94
- t.string "login", null: false
95
- t.string "email", null: false
96
- t.string "crypted_password", null: false
97
- t.string "password_salt", null: false
98
- t.string "persistence_token", null: false
99
- t.string "single_access_token", null: false
100
- t.string "perishable_token", null: false
101
- t.integer "login_count", default: 0, null: false
102
- t.integer "failed_login_count", default: 0, null: false
76
+ create_table "spud_users", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
77
+ t.string "first_name"
78
+ t.string "last_name"
79
+ t.boolean "super_admin"
80
+ t.string "login", null: false
81
+ t.string "email", null: false
82
+ t.string "crypted_password", null: false
83
+ t.string "password_salt", null: false
84
+ t.string "persistence_token", null: false
85
+ t.string "single_access_token", null: false
86
+ t.string "perishable_token", null: false
87
+ t.integer "login_count", default: 0, null: false
88
+ t.integer "failed_login_count", default: 0, null: false
103
89
  t.datetime "last_request_at"
104
90
  t.datetime "current_login_at"
105
91
  t.datetime "last_login_at"
106
- t.string "current_login_ip"
107
- t.string "last_login_ip"
108
- t.datetime "created_at", null: false
109
- t.datetime "updated_at", null: false
110
- t.string "time_zone"
111
- t.integer "spud_role_id"
92
+ t.string "current_login_ip"
93
+ t.string "last_login_ip"
94
+ t.datetime "created_at"
95
+ t.datetime "updated_at"
96
+ t.string "time_zone"
97
+ t.integer "spud_role_id"
98
+ t.boolean "requires_password_change", default: false
99
+ t.index ["email"], name: "index_spud_users_on_email"
100
+ t.index ["login"], name: "index_spud_users_on_login"
101
+ t.index ["spud_role_id"], name: "index_spud_users_on_spud_role_id"
112
102
  end
113
103
 
114
- add_index "spud_users", ["email"], name: "index_spud_users_on_email", using: :btree
115
- add_index "spud_users", ["login"], name: "index_spud_users_on_login", using: :btree
116
- add_index "spud_users", ["spud_role_id"], name: "index_spud_users_on_spud_role_id", using: :btree
117
-
118
104
  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'
@@ -0,0 +1,9 @@
1
+ FactoryBot.define do
2
+ factory :spud_banner_set do
3
+ sequence :name do |i|
4
+ "Test #{i}"
5
+ end
6
+ width 800
7
+ height 200
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ FactoryBot.define do
2
+ factory :spud_banner do
3
+ banner_file_name 'test.jpg'
4
+ banner_content_type 'image/jpeg'
5
+ banner_file_size 1
6
+ end
7
+ end
@@ -0,0 +1,27 @@
1
+ require 'rails_helper'
2
+
3
+ describe SpudBanner, type: 'model' do
4
+
5
+ let(:set) { create(:spud_banner_set) }
6
+
7
+ describe 'active' do
8
+ it 'returns active banners' do
9
+ banner = create(:spud_banner,
10
+ spud_banner_set_id: set.id,
11
+ start_date: Date.yesterday, end_date: Date.tomorrow)
12
+
13
+ result = SpudBanner.active
14
+ expect(result).to eq([banner])
15
+ end
16
+
17
+ it 'does not return inactive banners' do
18
+ create(:spud_banner,
19
+ spud_banner_set_id: set.id,
20
+ start_date: nil, end_date: Date.yesterday)
21
+
22
+ result = SpudBanner.active
23
+ expect(result).to eq([])
24
+ end
25
+ end
26
+
27
+ end