rails_adserver 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +0 -0
- data/Rakefile +40 -0
- data/app/assets/javascripts/rails_adserver/adspaces.js +2 -0
- data/app/assets/javascripts/rails_adserver/advertisements.js +2 -0
- data/app/assets/javascripts/rails_adserver/application.js +15 -0
- data/app/assets/javascripts/rails_adserver/rails_adserver_form.js.coffee +47 -0
- data/app/assets/stylesheets/rails_adserver/adspaces.css +4 -0
- data/app/assets/stylesheets/rails_adserver/advertisements.css +4 -0
- data/app/assets/stylesheets/rails_adserver/application.css +13 -0
- data/app/assets/stylesheets/rails_adserver/bootstrap-responsive.css +581 -0
- data/app/assets/stylesheets/rails_adserver/bootstrap.css +3496 -0
- data/app/assets/stylesheets/rails_adserver/pages.css +16 -0
- data/app/controllers/rails_adserver/adspaces_controller.rb +88 -0
- data/app/controllers/rails_adserver/advertisements_controller.rb +113 -0
- data/app/controllers/rails_adserver/application_controller.rb +25 -0
- data/app/controllers/rails_adserver/pages_controller.rb +9 -0
- data/app/helpers/rails_adserver/adspaces_helper.rb +4 -0
- data/app/helpers/rails_adserver/advertisements_helper.rb +4 -0
- data/app/helpers/rails_adserver/application_helper.rb +4 -0
- data/app/helpers/rails_adserver/pages_helper.rb +5 -0
- data/app/models/rails_adserver/adspace.rb +6 -0
- data/app/models/rails_adserver/advertisement.rb +110 -0
- data/app/models/rails_adserver/click.rb +5 -0
- data/app/uploaders/rails_adserver/advertisement_uploader.rb +56 -0
- data/app/views/layouts/rails_adserver/_sidebar.html.haml +21 -0
- data/app/views/layouts/rails_adserver/_topbar.html.haml +15 -0
- data/app/views/layouts/rails_adserver/advertisement.html.haml +3 -0
- data/app/views/layouts/rails_adserver/application.html.haml +25 -0
- data/app/views/rails_adserver/adspaces/_form.html.haml +16 -0
- data/app/views/rails_adserver/adspaces/edit.html.haml +1 -0
- data/app/views/rails_adserver/adspaces/index.html.haml +17 -0
- data/app/views/rails_adserver/adspaces/new.html.haml +1 -0
- data/app/views/rails_adserver/adspaces/show.html.haml +0 -0
- data/app/views/rails_adserver/advertisements/_advertisement.html.haml +7 -0
- data/app/views/rails_adserver/advertisements/_advertisements_table.html.haml +38 -0
- data/app/views/rails_adserver/advertisements/_form.html.haml +103 -0
- data/app/views/rails_adserver/advertisements/edit.html.haml +1 -0
- data/app/views/rails_adserver/advertisements/index.html.haml +2 -0
- data/app/views/rails_adserver/advertisements/new.html.haml +1 -0
- data/app/views/rails_adserver/advertisements/show.html.haml +5 -0
- data/app/views/rails_adserver/pages/home.html.haml +9 -0
- data/config/initializers/geokit.rb +1 -0
- data/config/initializers/haml.rb +2 -0
- data/config/routes.rb +10 -0
- data/db/migrate/20120227014859_create_rails_adserver_advertisements.rb +13 -0
- data/db/migrate/20120227014945_create_rails_adserver_clicks.rb +9 -0
- data/db/migrate/20120228000410_add_param_restriction_to_advertisement.rb +5 -0
- data/db/migrate/20120228000647_add_name_of_param_restriction_to_advertisement.rb +5 -0
- data/db/migrate/20120228010151_create_rails_adserver_adspaces.rb +8 -0
- data/db/migrate/20120228010315_add_name_to_adspace.rb +5 -0
- data/db/migrate/20120228043946_add_adspace_id_to_advertisement.rb +6 -0
- data/db/migrate/20120305034458_add_ad_type_to_advertisement.rb +6 -0
- data/db/migrate/20120305040026_add_parameter_restriction_boolean_to_advertisement.rb +6 -0
- data/db/migrate/20120305044238_add_more_options_to_advertisement.rb +7 -0
- data/db/migrate/20120305054319_add_image_to_advertisement.rb +5 -0
- data/db/migrate/20120305195421_add_max_clicks_to_advertisement.rb +6 -0
- data/db/migrate/20120305203049_add_indexes.rb +8 -0
- data/db/migrate/20120305212451_change_indexes.rb +11 -0
- data/db/migrate/20120305214753_add_click_count_to_advertisement.rb +6 -0
- data/db/migrate/20120306023105_geolocation.rb +5 -0
- data/db/migrate/20120306052705_add_geolocation_names_to_advertisements.rb +7 -0
- data/db/migrate/20120306065447_add_advertisement_indexes.rb +8 -0
- data/db/migrate/20120323174313_add_backup_boolean_to_ads.rb +5 -0
- data/db/migrate/20120328043354_add_view_count_to_ads.rb +6 -0
- data/db/migrate/20120328043651_add_views_to_ads.rb +6 -0
- data/lib/rails_adserver.rb +13 -0
- data/lib/rails_adserver/config.rb +13 -0
- data/lib/rails_adserver/engine.rb +5 -0
- data/lib/rails_adserver/version.rb +3 -0
- data/lib/tasks/rails_adserver_tasks.rake +4 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/javascripts/page.js +5 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/assets/stylesheets/page.css +4 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/page_controller.rb +4 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/helpers/page_helper.rb +2 -0
- data/test/dummy/app/models/user.rb +9 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/page/home.html.haml +1 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +57 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/carrierwave.rb +4 -0
- data/test/dummy/config/initializers/devise.rb +223 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/rails_adserver.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/devise.en.yml +57 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +10 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20120227204751_devise_create_users.rb +49 -0
- data/test/dummy/db/migrate/20120307204255_add_can_manage_ads_to_users.rb +6 -0
- data/test/dummy/db/schema.rb +84 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +26491 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/public/public/uploads/rails_adserver/advertisement/image/1/uszgP.jpg +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/test/fixtures/users.yml +11 -0
- data/test/dummy/test/functional/page_controller_test.rb +9 -0
- data/test/dummy/test/unit/helpers/page_helper_test.rb +4 -0
- data/test/dummy/test/unit/user_test.rb +7 -0
- data/test/dummy/tmp/cache/assets/C8F/860/sprockets%2Fd57276033f66173927e782e5c5b90c7b +0 -0
- data/test/dummy/tmp/cache/assets/C9E/E90/sprockets%2F4cebc1ca866a787736432410406a1b50 +0 -0
- data/test/dummy/tmp/cache/assets/CA6/990/sprockets%2F379e6655f2bcbb2380bc62b313314727 +0 -0
- data/test/dummy/tmp/cache/assets/CA7/ED0/sprockets%2F1e7b5a8a1137789918c115c01224bf4e +0 -0
- data/test/dummy/tmp/cache/assets/CC5/850/sprockets%2F7744952a67b1f4545bee9716f198c19b +0 -0
- data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/CE6/0F0/sprockets%2Ff173f2af55165a9415194d3e854c85da +0 -0
- data/test/dummy/tmp/cache/assets/CE7/DA0/sprockets%2F8ed8b29fe6a806301c31c79881a90c09 +0 -0
- data/test/dummy/tmp/cache/assets/CF2/CD0/sprockets%2Fda5995b74493c93c586f584b54c74a0b +0 -0
- data/test/dummy/tmp/cache/assets/CF3/920/sprockets%2F55f039ac18775d9358bdc75406f1e8f5 +0 -0
- data/test/dummy/tmp/cache/assets/D11/7F0/sprockets%2F9bcb57444f3287a8fa6fc45404e414c2 +0 -0
- data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/D35/D40/sprockets%2F75eff8f38359ea04cb0101ae2b91d702 +0 -0
- data/test/dummy/tmp/cache/assets/D3C/710/sprockets%2Fe62ab8b4376ed759a9cb72a62b0651e0 +0 -0
- data/test/dummy/tmp/cache/assets/D3D/A90/sprockets%2Fb9991dccd27b48a625b6a0146717ade3 +0 -0
- data/test/dummy/tmp/cache/assets/D3E/910/sprockets%2F5fdb0e602ada6a930583809f853d39bb +0 -0
- data/test/dummy/tmp/cache/assets/D3F/D00/sprockets%2Fbe9a1d851c3b30e4a710983eda7f7196 +0 -0
- data/test/dummy/tmp/cache/assets/D42/E30/sprockets%2F261c172e1fdf9b39a4678a48371eaad6 +0 -0
- data/test/dummy/tmp/cache/assets/D4D/2F0/sprockets%2Fd7dd6367378df15e4f0bb6d93fb41529 +0 -0
- data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/D5C/210/sprockets%2Fc78ac0bb1ca02e0ac1a566663840f8d6 +0 -0
- data/test/dummy/tmp/cache/assets/D5D/040/sprockets%2F539152cca8a2a9422e2a3ffa2a285d2d +0 -0
- data/test/dummy/tmp/cache/assets/D6D/670/sprockets%2F6ca4a9214539aeaf6f8401d3b77af16f +0 -0
- data/test/dummy/tmp/cache/assets/D73/BD0/sprockets%2Fac1f8d241dad59f05983cc1039ff4c58 +0 -0
- data/test/dummy/tmp/cache/assets/D7B/EA0/sprockets%2F0faa78844d169df84da0f122c89eb4f9 +0 -0
- data/test/dummy/tmp/cache/assets/D93/220/sprockets%2Fc0dcb0c6b055384fbd88d5b529c0da08 +0 -0
- data/test/dummy/tmp/cache/assets/DA0/180/sprockets%2F399fd2be6e4cf00a819a2630f8dd7ea2 +0 -0
- data/test/dummy/tmp/cache/assets/DB3/D90/sprockets%2F13d110dd2bde3bcd20b72f882330feae +0 -0
- data/test/dummy/tmp/cache/assets/DBA/2C0/sprockets%2F3879aa153bb0fe0de0fa0281f8cba2f2 +0 -0
- data/test/dummy/tmp/cache/assets/DCD/700/sprockets%2F57ee5a1f5e64e611b990eeadb75b14cb +0 -0
- data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/DDD/700/sprockets%2F78da8de4fc4dba2a5e7fa624ff518973 +0 -0
- data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/E06/950/sprockets%2Fbc8b0eff6fc13759f0c069b4f8bc3e6c +0 -0
- data/test/dummy/tmp/cache/assets/EB3/120/sprockets%2Fbaadea6fabac9ad5d1215ef8d3bf67a6 +0 -0
- data/test/fixtures/rails_adserver/adspaces.yml +11 -0
- data/test/fixtures/rails_adserver/advertisements.yml +15 -0
- data/test/fixtures/rails_adserver/clicks.yml +7 -0
- data/test/functional/rails_adserver/adspaces_controller_test.rb +51 -0
- data/test/functional/rails_adserver/advertisements_controller_test.rb +51 -0
- data/test/functional/rails_adserver/pages_controller_test.rb +9 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/rails_adserver_test.rb +7 -0
- data/test/test_helper.rb +10 -0
- data/test/unit/helpers/rails_adserver/adspaces_helper_test.rb +6 -0
- data/test/unit/helpers/rails_adserver/advertisements_helper_test.rb +6 -0
- data/test/unit/helpers/rails_adserver/pages_helper_test.rb +6 -0
- data/test/unit/rails_adserver/adspace_test.rb +9 -0
- data/test/unit/rails_adserver/advertisement_test.rb +9 -0
- data/test/unit/rails_adserver/click_test.rb +9 -0
- data/test/unit/rails_adserver/clicks_test.rb +9 -0
- metadata +401 -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
|
|
Binary file
|
|
@@ -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,11 @@
|
|
|
1
|
+
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
|
2
|
+
|
|
3
|
+
# This model initially had no columns defined. If you add columns to the
|
|
4
|
+
# model remove the '{}' from the fixture names and add the columns immediately
|
|
5
|
+
# below each fixture, per the syntax in the comments below
|
|
6
|
+
#
|
|
7
|
+
one: {}
|
|
8
|
+
# column: value
|
|
9
|
+
#
|
|
10
|
+
two: {}
|
|
11
|
+
# column: value
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
|
2
|
+
|
|
3
|
+
# This model initially had no columns defined. If you add columns to the
|
|
4
|
+
# model remove the '{}' from the fixture names and add the columns immediately
|
|
5
|
+
# below each fixture, per the syntax in the comments below
|
|
6
|
+
#
|
|
7
|
+
one: {}
|
|
8
|
+
# column: value
|
|
9
|
+
#
|
|
10
|
+
two: {}
|
|
11
|
+
# column: value
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
|
2
|
+
|
|
3
|
+
one:
|
|
4
|
+
title: MyString
|
|
5
|
+
content: MyText
|
|
6
|
+
width: 1
|
|
7
|
+
height: 1
|
|
8
|
+
is_active: false
|
|
9
|
+
|
|
10
|
+
two:
|
|
11
|
+
title: MyString
|
|
12
|
+
content: MyText
|
|
13
|
+
width: 1
|
|
14
|
+
height: 1
|
|
15
|
+
is_active: false
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
module RailsAdserver
|
|
4
|
+
class AdspacesControllerTest < ActionController::TestCase
|
|
5
|
+
setup do
|
|
6
|
+
@adspace = adspaces(:one)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
test "should get index" do
|
|
10
|
+
get :index
|
|
11
|
+
assert_response :success
|
|
12
|
+
assert_not_nil assigns(:adspaces)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
test "should get new" do
|
|
16
|
+
get :new
|
|
17
|
+
assert_response :success
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
test "should create adspace" do
|
|
21
|
+
assert_difference('Adspace.count') do
|
|
22
|
+
post :create, adspace: @adspace.attributes
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
assert_redirected_to adspace_path(assigns(:adspace))
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
test "should show adspace" do
|
|
29
|
+
get :show, id: @adspace
|
|
30
|
+
assert_response :success
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
test "should get edit" do
|
|
34
|
+
get :edit, id: @adspace
|
|
35
|
+
assert_response :success
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
test "should update adspace" do
|
|
39
|
+
put :update, id: @adspace, adspace: @adspace.attributes
|
|
40
|
+
assert_redirected_to adspace_path(assigns(:adspace))
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
test "should destroy adspace" do
|
|
44
|
+
assert_difference('Adspace.count', -1) do
|
|
45
|
+
delete :destroy, id: @adspace
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
assert_redirected_to adspaces_path
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
module RailsAdserver
|
|
4
|
+
class AdvertisementsControllerTest < ActionController::TestCase
|
|
5
|
+
setup do
|
|
6
|
+
@advertisement = advertisements(:one)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
test "should get index" do
|
|
10
|
+
get :index
|
|
11
|
+
assert_response :success
|
|
12
|
+
assert_not_nil assigns(:advertisements)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
test "should get new" do
|
|
16
|
+
get :new
|
|
17
|
+
assert_response :success
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
test "should create advertisement" do
|
|
21
|
+
assert_difference('Advertisement.count') do
|
|
22
|
+
post :create, advertisement: @advertisement.attributes
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
assert_redirected_to advertisement_path(assigns(:advertisement))
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
test "should show advertisement" do
|
|
29
|
+
get :show, id: @advertisement
|
|
30
|
+
assert_response :success
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
test "should get edit" do
|
|
34
|
+
get :edit, id: @advertisement
|
|
35
|
+
assert_response :success
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
test "should update advertisement" do
|
|
39
|
+
put :update, id: @advertisement, advertisement: @advertisement.attributes
|
|
40
|
+
assert_redirected_to advertisement_path(assigns(:advertisement))
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
test "should destroy advertisement" do
|
|
44
|
+
assert_difference('Advertisement.count', -1) do
|
|
45
|
+
delete :destroy, id: @advertisement
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
assert_redirected_to advertisements_path
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
data/test/test_helper.rb
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Configure Rails Environment
|
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
|
3
|
+
|
|
4
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
|
5
|
+
require "rails/test_help"
|
|
6
|
+
|
|
7
|
+
Rails.backtrace_cleaner.remove_silencers!
|
|
8
|
+
|
|
9
|
+
# Load support files
|
|
10
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|