advert_selector 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +132 -0
  3. data/Rakefile +40 -0
  4. data/app/assets/javascripts/advert_selector/application.js +15 -0
  5. data/app/assets/stylesheets/advert_selector/application.css +29 -0
  6. data/app/controllers/advert_selector/application_controller.rb +26 -0
  7. data/app/controllers/advert_selector/banners_controller.rb +122 -0
  8. data/app/controllers/advert_selector/main_controller.rb +13 -0
  9. data/app/controllers/advert_selector/placements_controller.rb +89 -0
  10. data/app/helpers/advert_selector/application_helper.rb +155 -0
  11. data/app/models/advert_selector/banner.rb +107 -0
  12. data/app/models/advert_selector/helper_item.rb +21 -0
  13. data/app/models/advert_selector/placement.rb +58 -0
  14. data/app/views/advert_selector/banners/_form.html.erb +42 -0
  15. data/app/views/advert_selector/banners/edit.html.erb +29 -0
  16. data/app/views/advert_selector/banners/index.html.erb +38 -0
  17. data/app/views/advert_selector/banners/new.html.erb +5 -0
  18. data/app/views/advert_selector/banners/show.html.erb +50 -0
  19. data/app/views/advert_selector/helper_items/_form.html.erb +37 -0
  20. data/app/views/advert_selector/helper_items/edit.html.erb +6 -0
  21. data/app/views/advert_selector/helper_items/index.html.erb +31 -0
  22. data/app/views/advert_selector/helper_items/new.html.erb +5 -0
  23. data/app/views/advert_selector/helper_items/show.html.erb +30 -0
  24. data/app/views/advert_selector/main/index.html.erb +20 -0
  25. data/app/views/advert_selector/placements/_form.html.erb +40 -0
  26. data/app/views/advert_selector/placements/edit.html.erb +6 -0
  27. data/app/views/advert_selector/placements/index.html.erb +25 -0
  28. data/app/views/advert_selector/placements/new.html.erb +5 -0
  29. data/app/views/advert_selector/placements/show.html.erb +20 -0
  30. data/app/views/layouts/advert_selector/application.html.erb +89 -0
  31. data/config/routes.rb +17 -0
  32. data/db/migrate/20120924165938_create_advert_selector_placements.rb +11 -0
  33. data/db/migrate/20120925122858_create_advert_selector_banners.rb +23 -0
  34. data/db/migrate/20120926132649_create_advert_selector_helper_items.rb +18 -0
  35. data/lib/advert_selector.rb +26 -0
  36. data/lib/advert_selector/engine.rb +18 -0
  37. data/lib/advert_selector/errors_cache.rb +21 -0
  38. data/lib/advert_selector/version.rb +3 -0
  39. data/lib/tasks/advert_selector_tasks.rake +4 -0
  40. data/test/advert_selector_test.rb +7 -0
  41. data/test/dummy/README.rdoc +261 -0
  42. data/test/dummy/Rakefile +7 -0
  43. data/test/dummy/app/assets/javascripts/application.js +15 -0
  44. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  45. data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
  46. data/test/dummy/app/controllers/application_controller.rb +4 -0
  47. data/test/dummy/app/controllers/examples_controller.rb +4 -0
  48. data/test/dummy/app/helpers/advert_selector_helper.rb +23 -0
  49. data/test/dummy/app/helpers/application_helper.rb +2 -0
  50. data/test/dummy/app/views/examples/index.html.erb +34 -0
  51. data/test/dummy/app/views/layouts/application.html.erb +20 -0
  52. data/test/dummy/config.ru +4 -0
  53. data/test/dummy/config/application.rb +59 -0
  54. data/test/dummy/config/boot.rb +10 -0
  55. data/test/dummy/config/database.yml +25 -0
  56. data/test/dummy/config/environment.rb +5 -0
  57. data/test/dummy/config/environments/development.rb +37 -0
  58. data/test/dummy/config/environments/production.rb +67 -0
  59. data/test/dummy/config/environments/test.rb +37 -0
  60. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  61. data/test/dummy/config/initializers/inflections.rb +15 -0
  62. data/test/dummy/config/initializers/mime_types.rb +5 -0
  63. data/test/dummy/config/initializers/secret_token.rb +7 -0
  64. data/test/dummy/config/initializers/session_store.rb +8 -0
  65. data/test/dummy/config/initializers/silence_assets.rb +20 -0
  66. data/test/dummy/config/initializers/simple_form.rb +178 -0
  67. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  68. data/test/dummy/config/locales/en.yml +5 -0
  69. data/test/dummy/config/locales/simple_form.en.yml +26 -0
  70. data/test/dummy/config/routes.rb +8 -0
  71. data/test/dummy/db/development.sqlite3 +0 -0
  72. data/test/dummy/db/migrate/20120928114159_create_advert_selector_placements.advert_selector.rb +12 -0
  73. data/test/dummy/db/migrate/20120928114160_create_advert_selector_banners.advert_selector.rb +24 -0
  74. data/test/dummy/db/migrate/20120928114161_create_advert_selector_helper_items.advert_selector.rb +19 -0
  75. data/test/dummy/db/schema.rb +53 -0
  76. data/test/dummy/db/test.sqlite3 +0 -0
  77. data/test/dummy/lib/templates/erb/scaffold/_form.html.erb +13 -0
  78. data/test/dummy/log/development.log +11516 -0
  79. data/test/dummy/log/test.log +66467 -0
  80. data/test/dummy/public/404.html +26 -0
  81. data/test/dummy/public/422.html +26 -0
  82. data/test/dummy/public/500.html +25 -0
  83. data/test/dummy/public/favicon.ico +0 -0
  84. data/test/dummy/script/rails +6 -0
  85. data/test/dummy/test/unit/helpers/examples_helper_test.rb +4 -0
  86. data/test/dummy/tmp/cache/88F/B60/AdvertSelectorBanner_2 +0 -0
  87. data/test/dummy/tmp/cache/943/570/advert_selector_errors +0 -0
  88. data/test/dummy/tmp/cache/A2C/760/AdvertSelectorBanner_207249520 +0 -0
  89. data/test/dummy/tmp/cache/A3E/CF0/AdvertSelectorBanner_394627963 +0 -0
  90. data/test/dummy/tmp/cache/A3F/BF0/AdvertSelectorBanner_814558298 +0 -0
  91. data/test/dummy/tmp/cache/A40/C00/AdvertSelectorBanner_814558299 +0 -0
  92. data/test/dummy/tmp/cache/assets/C57/D40/sprockets%2F4f1a95218761045e0b23975e889644aa +0 -0
  93. data/test/dummy/tmp/cache/assets/C5F/E80/sprockets%2F01c5361554f26407988a43647d88c5fe +0 -0
  94. data/test/dummy/tmp/cache/assets/C75/2E0/sprockets%2F23135a6eb5317973d290438c359a3c0a +0 -0
  95. data/test/dummy/tmp/cache/assets/C77/A40/sprockets%2F3b3d6c1426796a7024c7d3f42c283026 +0 -0
  96. data/test/dummy/tmp/cache/assets/C86/C20/sprockets%2Ffe1477ea429411b3b581466c928b6860 +0 -0
  97. data/test/dummy/tmp/cache/assets/C8C/B80/sprockets%2F371bf96e99717688ed7313a0c53f4212 +0 -0
  98. data/test/dummy/tmp/cache/assets/CBA/C70/sprockets%2F26288ca60ed05d24b8189328e4df9373 +0 -0
  99. data/test/dummy/tmp/cache/assets/CD1/A90/sprockets%2F433a791e2f93c0d8391aaa62203943ca +0 -0
  100. data/test/dummy/tmp/cache/assets/CD3/DE0/sprockets%2F0406286714c3c0abfcb4573336f7e33c +0 -0
  101. data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  102. data/test/dummy/tmp/cache/assets/CD9/E80/sprockets%2F9052578aacc61253aa3854fa03b4895d +0 -0
  103. data/test/dummy/tmp/cache/assets/CEB/040/sprockets%2F644677c3bb57b6ed6b675229cfe54305 +0 -0
  104. data/test/dummy/tmp/cache/assets/CF0/1D0/sprockets%2F6fc757c2c8329244ca95d6909865bbc2 +0 -0
  105. data/test/dummy/tmp/cache/assets/CF2/EF0/sprockets%2F30ffd128655c9f04e88fba233248e997 +0 -0
  106. data/test/dummy/tmp/cache/assets/CF7/B60/sprockets%2F2c2a2af94201088a2a815ba90b8d344c +0 -0
  107. data/test/dummy/tmp/cache/assets/D05/4D0/sprockets%2F2d14560f81284bfb61fc0e187a803f1d +0 -0
  108. data/test/dummy/tmp/cache/assets/D0E/380/sprockets%2Ff27b6f5008c5a7324a7d8a382f21e7f2 +0 -0
  109. data/test/dummy/tmp/cache/assets/D19/820/sprockets%2Fccd0e907b49615494cc88c43a4781a9c +0 -0
  110. data/test/dummy/tmp/cache/assets/D28/910/sprockets%2F79b8a6fa551206c9996cfe98b80492cb +0 -0
  111. data/test/dummy/tmp/cache/assets/D2D/C20/sprockets%2Ff7d7fd5892b198e1588dd7d90a29a717 +0 -0
  112. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  113. data/test/dummy/tmp/cache/assets/D36/570/sprockets%2Fadfccb7c2436e006496eae16d6901523 +0 -0
  114. data/test/dummy/tmp/cache/assets/D40/110/sprockets%2Fbc5fcd75a352287c59787234ccbb11a8 +0 -0
  115. data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  116. data/test/dummy/tmp/cache/assets/D50/030/sprockets%2F90296cd1ff74af449206b4fbd57cc995 +0 -0
  117. data/test/dummy/tmp/cache/assets/D50/BD0/sprockets%2F9c4832ce629b45b57ed8a55fbc717a86 +0 -0
  118. data/test/dummy/tmp/cache/assets/D55/240/sprockets%2F4b378a9f8c71e387569adfd712a26ce9 +0 -0
  119. data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  120. data/test/dummy/tmp/cache/assets/D68/0A0/sprockets%2F17a08f579f5d1585bbd0c6ce2bac4351 +0 -0
  121. data/test/dummy/tmp/cache/assets/D68/220/sprockets%2F701db0b265a7c593768caebb904de9a1 +0 -0
  122. data/test/dummy/tmp/cache/assets/D6A/EF0/sprockets%2F2eb65cc490ad96cc38604918b0caeb90 +0 -0
  123. data/test/dummy/tmp/cache/assets/D6F/040/sprockets%2Fbd56a4cbc86673dbf2242fb85571bf61 +0 -0
  124. data/test/dummy/tmp/cache/assets/D70/540/sprockets%2Ffb1dbed4c6b15bc994454964bd455a43 +0 -0
  125. data/test/dummy/tmp/cache/assets/D83/400/sprockets%2Fc5adb5e35a83a7e10361f02afa42d4c1 +0 -0
  126. data/test/dummy/tmp/cache/assets/D88/7F0/sprockets%2Fe3b83e01d5f51e442ec9c11b40cca81a +0 -0
  127. data/test/dummy/tmp/cache/assets/DA3/080/sprockets%2Ffb77a66783db0b5812e3fdbabe4608f6 +0 -0
  128. data/test/dummy/tmp/cache/assets/DCE/810/sprockets%2F6eeb2d90a03c9de3ce8f5f30acf58118 +0 -0
  129. data/test/dummy/tmp/cache/assets/DCE/D50/sprockets%2F2232ec55b4deca5e8120ced9bd79ef54 +0 -0
  130. data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  131. data/test/dummy/tmp/cache/assets/DF1/360/sprockets%2F23acf8b0d41e15db4d6ac2729f3eed1d +0 -0
  132. data/test/dummy/tmp/cache/assets/DF5/B00/sprockets%2Ff93edea94ff32d205acd8cdc4532b12b +0 -0
  133. data/test/dummy/tmp/cache/assets/DFB/9A0/sprockets%2Fb9a29f57d1ebf045452ed6cbd62eae1d +0 -0
  134. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  135. data/test/dummy/tmp/cache/assets/E53/3C0/sprockets%2Fcd0f7cae0b53d5ff22db8bf547d6a1bc +0 -0
  136. data/test/fixtures/advert_selector/banners.yml +38 -0
  137. data/test/fixtures/advert_selector/helper_items.yml +28 -0
  138. data/test/fixtures/advert_selector/placements.yml +17 -0
  139. data/test/functional/advert_selector/banners_controller_test.rb +64 -0
  140. data/test/functional/advert_selector/main_controller_test.rb +30 -0
  141. data/test/functional/advert_selector/placements_controller_test.rb +58 -0
  142. data/test/functional/examples_controller_test.rb +13 -0
  143. data/test/integration/banner_shows_test.rb +154 -0
  144. data/test/integration/navigation_test.rb +10 -0
  145. data/test/test_helper.rb +43 -0
  146. data/test/unit/advert_selector/banner_test.rb +160 -0
  147. data/test/unit/advert_selector/helper_item_test.rb +9 -0
  148. data/test/unit/advert_selector/placement_test.rb +50 -0
  149. data/test/unit/helpers/advert_selector/banners_helper_test.rb +6 -0
  150. data/test/unit/helpers/advert_selector/placements_helper_test.rb +6 -0
  151. metadata +425 -0
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ require 'test_helper'
2
+
3
+ class ExamplesHelperTest < ActionView::TestCase
4
+ end
@@ -0,0 +1,38 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ coke:
4
+ placement: leaderboard
5
+ name: Coke
6
+ start_time: <%= 5.days.ago.at_beginning_of_day.to_s(:db) %>
7
+ end_time: <%= 5.days.from_now.at_beginning_of_day.to_s(:db) %>
8
+ target_view_count: 1000
9
+ running_view_count: 100
10
+ frequency: nil
11
+ fast_mode: false
12
+ comment: "Coke banner"
13
+ confirmed: true
14
+ priority: 50
15
+
16
+ pepsi:
17
+ placement: leaderboard
18
+ name: Pepsi
19
+ start_time: <%= Time.now.at_beginning_of_day.to_s(:db) %>
20
+ end_time: <%= 10.days.from_now.at_beginning_of_day.to_s(:db) %>
21
+ target_view_count: 1000
22
+ frequency: nil
23
+ comment: "Pepsi banner"
24
+ fast_mode: true
25
+ confirmed: true
26
+ priority: 100
27
+
28
+ parade_banner:
29
+ placement: parade
30
+ name: parade_banner
31
+ start_time: <%= Time.now.at_beginning_of_day.to_s(:db) %>
32
+ end_time: <%= 10.days.from_now.at_beginning_of_day.to_s(:db) %>
33
+ target_view_count: 1000
34
+ frequency: 1
35
+ fast_mode: true
36
+ confirmed: false
37
+ priority: 1000
38
+
@@ -0,0 +1,28 @@
1
+ coke_content:
2
+ banner: coke
3
+ name: banner_leaderboard
4
+ content_for: true
5
+ content: "<img src='coke_banner'/>"
6
+ position: 1
7
+
8
+ pepsi_only_param_true:
9
+ banner: pepsi
10
+ name: request_params_include?
11
+ content_for: false
12
+ content: pepsi=true
13
+
14
+ pepsi_content:
15
+ banner: pepsi
16
+ position: 2
17
+ name: banner_leaderboard
18
+ content_for: true
19
+ content: "<img src='pepsi_banner'/>"
20
+
21
+ parade_content:
22
+ banner: parade_banner
23
+ position: 1
24
+ name: banner_parade
25
+ content_for: true
26
+ content: "<img src='banner_parade'/>"
27
+
28
+
@@ -0,0 +1,17 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ parade:
4
+ name: Parade
5
+ conflicting_placements_array: leaderboard,video
6
+
7
+ leaderboard:
8
+ name: Leaderboard
9
+ conflicting_placements_array: parade
10
+
11
+ video:
12
+ name: Video
13
+ only_once_per_session: true
14
+ conflicting_placements_array: parade
15
+
16
+
17
+
@@ -0,0 +1,64 @@
1
+ require File.dirname(__FILE__) + '/../../test_helper'
2
+
3
+ module AdvertSelector
4
+ class BannersControllerTest < ActionController::TestCase
5
+ setup do
6
+ AdvertSelector.admin_access_class = AdvertSelector::AdminAccessClassAlwaysTrue
7
+ @routes = AdvertSelector::Engine.routes # This would be same as calling get :index, :use_route => :advert_selector
8
+
9
+ @banner = advert_selector_banners(:pepsi)
10
+ end
11
+
12
+ test "should get index" do
13
+ get :index
14
+ assert_response :success
15
+ assert_not_nil assigns(:banners)
16
+ end
17
+
18
+ test "should get new" do
19
+ get :new
20
+ assert_response :success
21
+ end
22
+
23
+ test "should create banner" do
24
+ assert_difference('Banner.count') do
25
+ post :create, :banner => { :comment => @banner.comment, :end_time => @banner.end_time, :frequency => @banner.frequency, :name => @banner.name, :placement_id => @banner.placement_id, :start_time => @banner.start_time, :target_view_count => @banner.target_view_count }
26
+ end
27
+
28
+ assert_redirected_to banner_path(assigns(:banner))
29
+ end
30
+
31
+ test "should show banner" do
32
+ get :show, :id => @banner
33
+ assert_response :redirect
34
+ end
35
+
36
+ test "should get edit" do
37
+ get :edit, :id => @banner
38
+ assert_response :success
39
+ end
40
+
41
+ test "should update banner" do
42
+ put :update, :id => @banner, :banner => { :comment => @banner.comment }
43
+ assert_redirected_to banner_path(assigns(:banner))
44
+ end
45
+
46
+ test "should update banner running view count" do
47
+ @banner.add_one_viewcount
48
+ @banner.save
49
+ put :update_running_view_count, :id => @banner, :banner => { :running_view_count => 99 }
50
+ assert_response :redirect
51
+ assert_equal 99, @banner.running_view_count
52
+ assert_equal 99, AdvertSelector::Banner.find(@banner)[:running_view_count]
53
+
54
+ end
55
+
56
+ test "should destroy banner" do
57
+ assert_difference('Banner.count', -1) do
58
+ delete :destroy, :id => @banner
59
+ end
60
+
61
+ assert_redirected_to banners_path
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,30 @@
1
+ require 'test_helper'
2
+
3
+ module AdvertSelector
4
+ class MainControllerTest < ActionController::TestCase
5
+
6
+ setup do
7
+ AdvertSelector.admin_access_class = AdvertSelector::AdminAccessClassAlwaysTrue
8
+ @routes = AdvertSelector::Engine.routes # This would be same as calling get :index, :use_route => :advert_selector
9
+ end
10
+
11
+ test "should get index" do
12
+ get :index
13
+ assert_response :success
14
+ end
15
+
16
+ test "should clear errors log" do
17
+ AdvertSelector::ErrorsCache.add('str')
18
+ get :clear_errors_log
19
+ assert_response :redirect
20
+ assert AdvertSelector::ErrorsCache.errors.blank?
21
+ end
22
+
23
+ test "forbidden with default access" do
24
+ AdvertSelector.admin_access_class = AdvertSelector::AdminAccessClassDefault
25
+ get :index
26
+ assert_response 403
27
+ end
28
+
29
+ end
30
+ end
@@ -0,0 +1,58 @@
1
+ require File.dirname(__FILE__) + '/../../test_helper'
2
+
3
+ module AdvertSelector
4
+ class PlacementsControllerTest < ActionController::TestCase
5
+ fixtures :all
6
+
7
+ setup do
8
+ AdvertSelector.admin_access_class = AdvertSelector::AdminAccessClassAlwaysTrue
9
+ @routes = AdvertSelector::Engine.routes # This would be same as calling get :index, :use_route => :advert_selector
10
+
11
+ @placement = advert_selector_placements(:leaderboard)
12
+ end
13
+
14
+ test "should get index" do
15
+ get :index
16
+ assert_response :success
17
+ assert_not_nil assigns(:placements)
18
+ end
19
+
20
+ test "should get new" do
21
+ get :new
22
+ assert_response :success
23
+ end
24
+
25
+ test "should create placement" do
26
+ assert_difference('Placement.count') do
27
+ #post :create, :placement => { :conflicting_placements_array => @placement.conflicting_placements_array, :name => @placement.name }
28
+ post :create, :placement => { :name => "new placement" }
29
+ end
30
+
31
+ assert_redirected_to placement_path(assigns(:placement))
32
+ end
33
+
34
+ test "should show placement" do
35
+ get :show, :id => @placement
36
+ assert_response :redirect
37
+ end
38
+
39
+ test "should get edit" do
40
+ get :edit, :id => @placement
41
+ assert_response :success
42
+ end
43
+
44
+ test "should update placement" do
45
+ put :update, :id => @placement, :placement => { :name => @placement.name }
46
+ #assert_redirected_to placement_path(assigns(:placement))
47
+ assert_redirected_to placement_path(assigns(:placement))
48
+ end
49
+
50
+ test "should destroy placement" do
51
+ assert_difference('Placement.count', -1) do
52
+ delete :destroy, :id => @placement
53
+ end
54
+
55
+ assert_redirected_to placements_path
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,13 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class ExamplesControllerTest < ActionController::TestCase
4
+
5
+ test "render video once per session" do
6
+ get :index
7
+ assert_response :success
8
+
9
+ #binding.pry
10
+
11
+ end
12
+
13
+ end