epom_rails 1.0.0 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/lib/epom_rails/acts_as.rb +41 -14
  3. data/lib/epom_rails/acts_as_advertiser.rb +24 -0
  4. data/lib/epom_rails/acts_as_analytic.rb +33 -0
  5. data/lib/epom_rails/acts_as_campaign.rb +20 -1
  6. data/lib/epom_rails/acts_as_zone.rb +19 -0
  7. data/lib/epom_rails/config.rb +8 -6
  8. data/lib/epom_rails/version.rb +1 -1
  9. data/lib/epom_rails.rb +5 -3
  10. data/lib/generators/epom_rails/config/templates/epom_rails.rb +7 -4
  11. data/test/dummy/app/assets/javascripts/analytics.js +2 -0
  12. data/test/dummy/app/assets/stylesheets/analytics.css +4 -0
  13. data/test/dummy/app/controllers/analytics_controller.rb +58 -0
  14. data/test/dummy/app/controllers/zones_controller.rb +1 -1
  15. data/test/dummy/app/helpers/analytics_helper.rb +2 -0
  16. data/test/dummy/app/models/advertiser.rb +2 -1
  17. data/test/dummy/app/models/analytic.rb +3 -0
  18. data/test/dummy/app/models/banner.rb +2 -0
  19. data/test/dummy/app/models/campaign.rb +3 -0
  20. data/test/dummy/app/models/placement.rb +2 -0
  21. data/test/dummy/app/models/publisher.rb +1 -0
  22. data/test/dummy/app/models/zone.rb +3 -0
  23. data/test/dummy/app/views/analytics/_form.html.erb +133 -0
  24. data/test/dummy/app/views/analytics/edit.html.erb +6 -0
  25. data/test/dummy/app/views/analytics/index.html.erb +83 -0
  26. data/test/dummy/app/views/analytics/new.html.erb +5 -0
  27. data/test/dummy/app/views/analytics/show.html.erb +149 -0
  28. data/test/dummy/app/views/zones/_form.html.erb +2 -2
  29. data/test/dummy/app/views/zones/index.html.erb +2 -2
  30. data/test/dummy/app/views/zones/show.html.erb +2 -2
  31. data/test/dummy/config/routes.rb +2 -1
  32. data/test/dummy/db/migrate/{20150622160449_create_zones.rb → 20150803195716_create_zones.rb} +1 -1
  33. data/test/dummy/db/migrate/20150821041145_create_analytics.rb +37 -0
  34. data/test/dummy/db/schema.rb +38 -4
  35. data/test/dummy/test/controllers/analytics_controller_test.rb +49 -0
  36. data/test/dummy/test/controllers/banners_controller_test.rb +3 -1
  37. data/test/dummy/test/controllers/campaigns_controller_test.rb +4 -2
  38. data/test/dummy/test/controllers/placements_controller_test.rb +5 -3
  39. data/test/dummy/test/controllers/publishers_controller_test.rb +2 -2
  40. data/test/dummy/test/controllers/zones_controller_test.rb +5 -3
  41. data/test/dummy/test/fixtures/advertisers.yml +1 -0
  42. data/test/dummy/test/fixtures/analytics.yml +63 -0
  43. data/test/dummy/test/fixtures/banners.yml +16 -1
  44. data/test/dummy/test/fixtures/campaigns.yml +3 -2
  45. data/test/dummy/test/fixtures/placements.yml +4 -3
  46. data/test/dummy/test/fixtures/publishers.yml +2 -1
  47. data/test/dummy/test/fixtures/zones.yml +3 -2
  48. data/test/dummy/test/models/analytic_test.rb +7 -0
  49. data/test/epom_rails/acts_as_advertiser_test.rb +54 -1
  50. data/test/epom_rails/acts_as_analytic_test.rb +9 -0
  51. data/test/epom_rails/acts_as_banner_test.rb +9 -6
  52. data/test/epom_rails/acts_as_campaign_test.rb +24 -5
  53. data/test/epom_rails/acts_as_placement_test.rb +6 -3
  54. data/test/epom_rails/acts_as_site_test.rb +8 -5
  55. data/test/epom_rails/acts_as_zone_test.rb +16 -3
  56. data/test/test_helper.rb +8 -5
  57. metadata +42 -11
@@ -0,0 +1,83 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <h1>Listing Analytics</h1>
4
+
5
+ <table>
6
+ <thead>
7
+ <tr>
8
+ <th>Date</th>
9
+ <th>Hour</th>
10
+ <th>Advertiser</th>
11
+ <th>Advertiser</th>
12
+ <th>Campaign</th>
13
+ <th>Campaign</th>
14
+ <th>Banner</th>
15
+ <th>Banner</th>
16
+ <th>Site</th>
17
+ <th>Site</th>
18
+ <th>Zone</th>
19
+ <th>Zone</th>
20
+ <th>Placement</th>
21
+ <th>Placement</th>
22
+ <th>Channel</th>
23
+ <th>Country</th>
24
+ <th>Impressions</th>
25
+ <th>Clicks</th>
26
+ <th>Ctr</th>
27
+ <th>Conversions</th>
28
+ <th>I2c</th>
29
+ <th>Ccr</th>
30
+ <th>Net</th>
31
+ <th>Gross</th>
32
+ <th>Profit</th>
33
+ <th>Ecpm net</th>
34
+ <th>Ecpm gross</th>
35
+ <th>Ecpm profit</th>
36
+ <th>Status</th>
37
+ <th colspan="3"></th>
38
+ </tr>
39
+ </thead>
40
+
41
+ <tbody>
42
+ <% @analytics.each do |analytic| %>
43
+ <tr>
44
+ <td><%= analytic.date %></td>
45
+ <td><%= analytic.hour %></td>
46
+ <td><%= analytic.advertiser %></td>
47
+ <td><%= analytic.advertiser_id %></td>
48
+ <td><%= analytic.campaign %></td>
49
+ <td><%= analytic.campaign_id %></td>
50
+ <td><%= analytic.banner %></td>
51
+ <td><%= analytic.banner_id %></td>
52
+ <td><%= analytic.site %></td>
53
+ <td><%= analytic.site_id %></td>
54
+ <td><%= analytic.zone %></td>
55
+ <td><%= analytic.zone_id %></td>
56
+ <td><%= analytic.placement %></td>
57
+ <td><%= analytic.placement_id %></td>
58
+ <td><%= analytic.channel %></td>
59
+ <td><%= analytic.country %></td>
60
+ <td><%= analytic.impressions %></td>
61
+ <td><%= analytic.clicks %></td>
62
+ <td><%= analytic.ctr %></td>
63
+ <td><%= analytic.conversions %></td>
64
+ <td><%= analytic.i2c %></td>
65
+ <td><%= analytic.ccr %></td>
66
+ <td><%= analytic.net %></td>
67
+ <td><%= analytic.gross %></td>
68
+ <td><%= analytic.profit %></td>
69
+ <td><%= analytic.ecpm_net %></td>
70
+ <td><%= analytic.ecpm_gross %></td>
71
+ <td><%= analytic.ecpm_profit %></td>
72
+ <td><%= analytic.status %></td>
73
+ <td><%= link_to 'Show', analytic %></td>
74
+ <td><%= link_to 'Edit', edit_analytic_path(analytic) %></td>
75
+ <td><%= link_to 'Destroy', analytic, method: :delete, data: { confirm: 'Are you sure?' } %></td>
76
+ </tr>
77
+ <% end %>
78
+ </tbody>
79
+ </table>
80
+
81
+ <br>
82
+
83
+ <%= link_to 'New Analytic', new_analytic_path %>
@@ -0,0 +1,5 @@
1
+ <h1>New Analytic</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', analytics_path %>
@@ -0,0 +1,149 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <strong>Date:</strong>
5
+ <%= @analytic.date %>
6
+ </p>
7
+
8
+ <p>
9
+ <strong>Hour:</strong>
10
+ <%= @analytic.hour %>
11
+ </p>
12
+
13
+ <p>
14
+ <strong>Advertiser:</strong>
15
+ <%= @analytic.advertiser %>
16
+ </p>
17
+
18
+ <p>
19
+ <strong>Advertiser:</strong>
20
+ <%= @analytic.advertiser_id %>
21
+ </p>
22
+
23
+ <p>
24
+ <strong>Campaign:</strong>
25
+ <%= @analytic.campaign %>
26
+ </p>
27
+
28
+ <p>
29
+ <strong>Campaign:</strong>
30
+ <%= @analytic.campaign_id %>
31
+ </p>
32
+
33
+ <p>
34
+ <strong>Banner:</strong>
35
+ <%= @analytic.banner %>
36
+ </p>
37
+
38
+ <p>
39
+ <strong>Banner:</strong>
40
+ <%= @analytic.banner_id %>
41
+ </p>
42
+
43
+ <p>
44
+ <strong>Site:</strong>
45
+ <%= @analytic.site %>
46
+ </p>
47
+
48
+ <p>
49
+ <strong>Site:</strong>
50
+ <%= @analytic.site_id %>
51
+ </p>
52
+
53
+ <p>
54
+ <strong>Zone:</strong>
55
+ <%= @analytic.zone %>
56
+ </p>
57
+
58
+ <p>
59
+ <strong>Zone:</strong>
60
+ <%= @analytic.zone_id %>
61
+ </p>
62
+
63
+ <p>
64
+ <strong>Placement:</strong>
65
+ <%= @analytic.placement %>
66
+ </p>
67
+
68
+ <p>
69
+ <strong>Placement:</strong>
70
+ <%= @analytic.placement_id %>
71
+ </p>
72
+
73
+ <p>
74
+ <strong>Channel:</strong>
75
+ <%= @analytic.channel %>
76
+ </p>
77
+
78
+ <p>
79
+ <strong>Country:</strong>
80
+ <%= @analytic.country %>
81
+ </p>
82
+
83
+ <p>
84
+ <strong>Impressions:</strong>
85
+ <%= @analytic.impressions %>
86
+ </p>
87
+
88
+ <p>
89
+ <strong>Clicks:</strong>
90
+ <%= @analytic.clicks %>
91
+ </p>
92
+
93
+ <p>
94
+ <strong>Ctr:</strong>
95
+ <%= @analytic.ctr %>
96
+ </p>
97
+
98
+ <p>
99
+ <strong>Conversions:</strong>
100
+ <%= @analytic.conversions %>
101
+ </p>
102
+
103
+ <p>
104
+ <strong>I2c:</strong>
105
+ <%= @analytic.i2c %>
106
+ </p>
107
+
108
+ <p>
109
+ <strong>Ccr:</strong>
110
+ <%= @analytic.ccr %>
111
+ </p>
112
+
113
+ <p>
114
+ <strong>Net:</strong>
115
+ <%= @analytic.net %>
116
+ </p>
117
+
118
+ <p>
119
+ <strong>Gross:</strong>
120
+ <%= @analytic.gross %>
121
+ </p>
122
+
123
+ <p>
124
+ <strong>Profit:</strong>
125
+ <%= @analytic.profit %>
126
+ </p>
127
+
128
+ <p>
129
+ <strong>Ecpm net:</strong>
130
+ <%= @analytic.ecpm_net %>
131
+ </p>
132
+
133
+ <p>
134
+ <strong>Ecpm gross:</strong>
135
+ <%= @analytic.ecpm_gross %>
136
+ </p>
137
+
138
+ <p>
139
+ <strong>Ecpm profit:</strong>
140
+ <%= @analytic.ecpm_profit %>
141
+ </p>
142
+
143
+ <p>
144
+ <strong>Status:</strong>
145
+ <%= @analytic.status %>
146
+ </p>
147
+
148
+ <%= link_to 'Edit', edit_analytic_path(@analytic) %> |
149
+ <%= link_to 'Back', analytics_path %>
@@ -24,8 +24,8 @@
24
24
  <%= f.text_area :description %>
25
25
  </div>
26
26
  <div class="field">
27
- <%= f.label :site_id %><br>
28
- <%= f.number_field :site_id %>
27
+ <%= f.label :publisher_id %><br>
28
+ <%= f.number_field :publisher_id %>
29
29
  </div>
30
30
  <div class="actions">
31
31
  <%= f.submit %>
@@ -8,7 +8,7 @@
8
8
  <th>Epom</th>
9
9
  <th>Name</th>
10
10
  <th>Description</th>
11
- <th>Site</th>
11
+ <th>Publisher</th>
12
12
  <th colspan="3"></th>
13
13
  </tr>
14
14
  </thead>
@@ -19,7 +19,7 @@
19
19
  <td><%= zone.epom_id %></td>
20
20
  <td><%= zone.name %></td>
21
21
  <td><%= zone.description %></td>
22
- <td><%= zone.site_id %></td>
22
+ <td><%= zone.publisher_id %></td>
23
23
  <td><%= link_to 'Show', zone %></td>
24
24
  <td><%= link_to 'Edit', edit_zone_path(zone) %></td>
25
25
  <td><%= link_to 'Destroy', zone, method: :delete, data: { confirm: 'Are you sure?' } %></td>
@@ -16,8 +16,8 @@
16
16
  </p>
17
17
 
18
18
  <p>
19
- <strong>Site:</strong>
20
- <%= @zone.site_id %>
19
+ <strong>Publisher:</strong>
20
+ <%= @zone.publisher_id %>
21
21
  </p>
22
22
 
23
23
  <%= link_to 'Edit', edit_zone_path(@zone) %> |
@@ -1,8 +1,9 @@
1
1
  Rails.application.routes.draw do
2
+ resources :analytics
3
+ resources :zones
2
4
  resources :publishers
3
5
  resources :placements
4
6
  resources :placements
5
- resources :zones
6
7
  resources :sites
7
8
  resources :banners
8
9
  resources :campaigns
@@ -4,7 +4,7 @@ class CreateZones < ActiveRecord::Migration
4
4
  t.integer :epom_id
5
5
  t.string :name
6
6
  t.text :description
7
- t.integer :site_id
7
+ t.integer :publisher_id
8
8
 
9
9
  t.timestamps null: false
10
10
  end
@@ -0,0 +1,37 @@
1
+ class CreateAnalytics < ActiveRecord::Migration
2
+ def change
3
+ create_table :analytics do |t|
4
+ t.date :date
5
+ t.time :hour
6
+ t.string :advertiser
7
+ t.integer :advertiser_id
8
+ t.string :campaign
9
+ t.integer :campaign_id
10
+ t.string :banner
11
+ t.integer :banner_id
12
+ t.string :site
13
+ t.integer :site_id
14
+ t.string :zone
15
+ t.integer :zone_id
16
+ t.string :placement
17
+ t.integer :placement_id
18
+ t.string :channel
19
+ t.string :country
20
+ t.integer :impressions
21
+ t.integer :clicks
22
+ t.float :ctr
23
+ t.integer :conversions
24
+ t.float :i2c
25
+ t.float :ccr
26
+ t.integer :net
27
+ t.integer :gross
28
+ t.integer :profit
29
+ t.integer :ecpm_net
30
+ t.integer :ecpm_gross
31
+ t.integer :ecpm_profit
32
+ t.string :status
33
+
34
+ t.timestamps null: false
35
+ end
36
+ end
37
+ end
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20150731161340) do
14
+ ActiveRecord::Schema.define(version: 20150821041145) do
15
15
 
16
16
  create_table "advertisers", force: :cascade do |t|
17
17
  t.string "name"
@@ -23,6 +23,40 @@ ActiveRecord::Schema.define(version: 20150731161340) do
23
23
  t.integer "epom_id"
24
24
  end
25
25
 
26
+ create_table "analytics", force: :cascade do |t|
27
+ t.date "date"
28
+ t.time "hour"
29
+ t.string "advertiser"
30
+ t.integer "advertiser_id"
31
+ t.string "campaign"
32
+ t.integer "campaign_id"
33
+ t.string "banner"
34
+ t.integer "banner_id"
35
+ t.string "site"
36
+ t.integer "site_id"
37
+ t.string "zone"
38
+ t.integer "zone_id"
39
+ t.string "placement"
40
+ t.integer "placement_id"
41
+ t.string "channel"
42
+ t.string "country"
43
+ t.integer "impressions"
44
+ t.integer "clicks"
45
+ t.float "ctr"
46
+ t.integer "conversions"
47
+ t.float "i2c"
48
+ t.float "ccr"
49
+ t.integer "net"
50
+ t.integer "gross"
51
+ t.integer "profit"
52
+ t.integer "ecpm_net"
53
+ t.integer "ecpm_gross"
54
+ t.integer "ecpm_profit"
55
+ t.string "status"
56
+ t.datetime "created_at", null: false
57
+ t.datetime "updated_at", null: false
58
+ end
59
+
26
60
  create_table "banners", force: :cascade do |t|
27
61
  t.integer "epom_id"
28
62
  t.string "placement_type"
@@ -76,9 +110,9 @@ ActiveRecord::Schema.define(version: 20150731161340) do
76
110
  t.integer "epom_id"
77
111
  t.string "name"
78
112
  t.text "description"
79
- t.integer "site_id"
80
- t.datetime "created_at", null: false
81
- t.datetime "updated_at", null: false
113
+ t.integer "publisher_id"
114
+ t.datetime "created_at", null: false
115
+ t.datetime "updated_at", null: false
82
116
  end
83
117
 
84
118
  end
@@ -0,0 +1,49 @@
1
+ require 'test_helper'
2
+
3
+ class AnalyticsControllerTest < ActionController::TestCase
4
+ setup do
5
+ @analytic = analytics(:one)
6
+ end
7
+
8
+ test "should get index" do
9
+ get :index
10
+ assert_response :success
11
+ assert_not_nil assigns(:analytics)
12
+ end
13
+
14
+ test "should get new" do
15
+ get :new
16
+ assert_response :success
17
+ end
18
+
19
+ test "should create analytic" do
20
+ assert_difference('Analytic.count') do
21
+ post :create, analytic: { advertiser: @analytic.advertiser, advertiser_id: @analytic.advertiser_id, banner: @analytic.banner, banner_id: @analytic.banner_id, campaign: @analytic.campaign, campaign_id: @analytic.campaign_id, ccr: @analytic.ccr, channel: @analytic.channel, clicks: @analytic.clicks, conversions: @analytic.conversions, country: @analytic.country, ctr: @analytic.ctr, date: @analytic.date, ecpm_gross: @analytic.ecpm_gross, ecpm_net: @analytic.ecpm_net, ecpm_profit: @analytic.ecpm_profit, gross: @analytic.gross, hour: @analytic.hour, i2c: @analytic.i2c, impressions: @analytic.impressions, net: @analytic.net, placement: @analytic.placement, placement_id: @analytic.placement_id, profit: @analytic.profit, site: @analytic.site, site_id: @analytic.site_id, status: @analytic.status, zone: @analytic.zone, zone_id: @analytic.zone_id }
22
+ end
23
+
24
+ assert_redirected_to analytic_path(assigns(:analytic))
25
+ end
26
+
27
+ test "should show analytic" do
28
+ get :show, id: @analytic
29
+ assert_response :success
30
+ end
31
+
32
+ test "should get edit" do
33
+ get :edit, id: @analytic
34
+ assert_response :success
35
+ end
36
+
37
+ test "should update analytic" do
38
+ patch :update, id: @analytic, analytic: { advertiser: @analytic.advertiser, advertiser_id: @analytic.advertiser_id, banner: @analytic.banner, banner_id: @analytic.banner_id, campaign: @analytic.campaign, campaign_id: @analytic.campaign_id, ccr: @analytic.ccr, channel: @analytic.channel, clicks: @analytic.clicks, conversions: @analytic.conversions, country: @analytic.country, ctr: @analytic.ctr, date: @analytic.date, ecpm_gross: @analytic.ecpm_gross, ecpm_net: @analytic.ecpm_net, ecpm_profit: @analytic.ecpm_profit, gross: @analytic.gross, hour: @analytic.hour, i2c: @analytic.i2c, impressions: @analytic.impressions, net: @analytic.net, placement: @analytic.placement, placement_id: @analytic.placement_id, profit: @analytic.profit, site: @analytic.site, site_id: @analytic.site_id, status: @analytic.status, zone: @analytic.zone, zone_id: @analytic.zone_id }
39
+ assert_redirected_to analytic_path(assigns(:analytic))
40
+ end
41
+
42
+ test "should destroy analytic" do
43
+ assert_difference('Analytic.count', -1) do
44
+ delete :destroy, id: @analytic
45
+ end
46
+
47
+ assert_redirected_to analytics_path
48
+ end
49
+ end
@@ -2,7 +2,7 @@ require 'test_helper'
2
2
 
3
3
  class BannersControllerTest < ActionController::TestCase
4
4
  setup do
5
- @banner = banners(:one)
5
+ @banner = banners(:two)
6
6
  end
7
7
 
8
8
  test "should get index" do
@@ -40,6 +40,8 @@ class BannersControllerTest < ActionController::TestCase
40
40
  end
41
41
 
42
42
  test "should destroy banner" do
43
+ @banner.epom_id = nil
44
+ @banner.save
43
45
  assert_difference('Banner.count', -1) do
44
46
  delete :destroy, id: @banner
45
47
  end
@@ -2,7 +2,7 @@ require 'test_helper'
2
2
 
3
3
  class CampaignsControllerTest < ActionController::TestCase
4
4
  setup do
5
- @campaign = campaigns(:one)
5
+ @campaign = campaigns(:two)
6
6
  end
7
7
 
8
8
  test "should get index" do
@@ -35,11 +35,13 @@ class CampaignsControllerTest < ActionController::TestCase
35
35
  end
36
36
 
37
37
  test "should update campaign" do
38
- patch :update, id: @campaign, campaign: { advertiser_id: @campaign.advertiser_id, description: @campaign.description, name: @campaign.name, weight: @campaign.weight }
38
+ patch :update, id: campaigns(:one), campaign: { advertiser_id: @campaign.advertiser_id, description: @campaign.description, name: @campaign.name, weight: @campaign.weight }
39
39
  assert_redirected_to campaign_path(assigns(:campaign))
40
40
  end
41
41
 
42
42
  test "should destroy campaign" do
43
+ @campaign.epom_id = nil
44
+ @campaign.save
43
45
  assert_difference('Campaign.count', -1) do
44
46
  delete :destroy, id: @campaign
45
47
  end
@@ -2,7 +2,7 @@ require 'test_helper'
2
2
 
3
3
  class PlacementsControllerTest < ActionController::TestCase
4
4
  setup do
5
- @placement = placements(:one)
5
+ @placement = placements(:two)
6
6
  end
7
7
 
8
8
  test "should get index" do
@@ -18,7 +18,7 @@ class PlacementsControllerTest < ActionController::TestCase
18
18
 
19
19
  test "should create placement" do
20
20
  assert_difference('Placement.count') do
21
- post :create, placement: { ad_unit_id: @placement.ad_unit_id, epom_id: @placement.epom_id, name: @placement.name, placement_type: @placement.placement_type, size_height: @placement.size_height, size_width: @placement.size_width, zone_id: @placement.zone_id }
21
+ post :create, placement: { ad_unit_id: @placement.ad_unit_id, name: @placement.name, placement_type: @placement.placement_type, size_height: @placement.size_height, size_width: @placement.size_width, zone_id: @placement.zone_id }
22
22
  end
23
23
 
24
24
  assert_redirected_to placement_path(assigns(:placement))
@@ -35,11 +35,13 @@ class PlacementsControllerTest < ActionController::TestCase
35
35
  end
36
36
 
37
37
  test "should update placement" do
38
- patch :update, id: @placement, placement: { ad_unit_id: @placement.ad_unit_id, epom_id: @placement.epom_id, name: @placement.name, placement_type: @placement.placement_type, size_height: @placement.size_height, size_width: @placement.size_width, zone_id: @placement.zone_id }
38
+ patch :update, id: placements(:one), placement: { ad_unit_id: @placement.ad_unit_id, name: @placement.name, placement_type: @placement.placement_type, size_height: @placement.size_height, size_width: @placement.size_width, zone_id: @placement.zone_id }
39
39
  assert_redirected_to placement_path(assigns(:placement))
40
40
  end
41
41
 
42
42
  test "should destroy placement" do
43
+ @placement.epom_id = nil
44
+ @placement.save
43
45
  assert_difference('Placement.count', -1) do
44
46
  delete :destroy, id: @placement
45
47
  end
@@ -18,7 +18,7 @@ class PublishersControllerTest < ActionController::TestCase
18
18
 
19
19
  test "should create publisher" do
20
20
  assert_difference('Publisher.count') do
21
- post :create, publisher: { category_id: @publisher.category_id, description: @publisher.description, email: @publisher.email, epom_id: @publisher.epom_id, name: @publisher.name, url: @publisher.url }
21
+ post :create, publisher: { category_id: @publisher.category_id, description: @publisher.description, email: @publisher.email, name: @publisher.name, url: @publisher.url }
22
22
  end
23
23
 
24
24
  assert_redirected_to publisher_path(assigns(:publisher))
@@ -35,7 +35,7 @@ class PublishersControllerTest < ActionController::TestCase
35
35
  end
36
36
 
37
37
  test "should update publisher" do
38
- patch :update, id: @publisher, publisher: { category_id: @publisher.category_id, description: @publisher.description, email: @publisher.email, epom_id: @publisher.epom_id, name: @publisher.name, url: @publisher.url }
38
+ patch :update, id: @publisher, publisher: { category_id: @publisher.category_id, description: @publisher.description, email: @publisher.email, name: @publisher.name, url: @publisher.url }
39
39
  assert_redirected_to publisher_path(assigns(:publisher))
40
40
  end
41
41
 
@@ -2,7 +2,7 @@ require 'test_helper'
2
2
 
3
3
  class ZonesControllerTest < ActionController::TestCase
4
4
  setup do
5
- @zone = zones(:one)
5
+ @zone = zones(:two)
6
6
  end
7
7
 
8
8
  test "should get index" do
@@ -18,7 +18,7 @@ class ZonesControllerTest < ActionController::TestCase
18
18
 
19
19
  test "should create zone" do
20
20
  assert_difference('Zone.count') do
21
- post :create, zone: { description: @zone.description, epom_id: @zone.epom_id, name: @zone.name, site_id: @zone.site_id }
21
+ post :create, zone: { description: @zone.description, epom_id: @zone.epom_id, name: @zone.name, publisher_id: @zone.publisher_id }
22
22
  end
23
23
 
24
24
  assert_redirected_to zone_path(assigns(:zone))
@@ -35,11 +35,13 @@ class ZonesControllerTest < ActionController::TestCase
35
35
  end
36
36
 
37
37
  test "should update zone" do
38
- patch :update, id: @zone, zone: { description: @zone.description, epom_id: @zone.epom_id, name: @zone.name, site_id: @zone.site_id }
38
+ patch :update, id: @zone, zone: { description: @zone.description, epom_id: @zone.epom_id, name: @zone.name, publisher_id: @zone.publisher_id }
39
39
  assert_redirected_to zone_path(assigns(:zone))
40
40
  end
41
41
 
42
42
  test "should destroy zone" do
43
+ @zone.epom_id = nil
44
+ @zone.save
43
45
  assert_difference('Zone.count', -1) do
44
46
  delete :destroy, id: @zone
45
47
  end
@@ -11,3 +11,4 @@ two:
11
11
  contact_name: MyString
12
12
  contact_email:
13
13
  description: MyText
14
+ epom_id: 2
@@ -0,0 +1,63 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+ one:
4
+ date: 2015-08-21
5
+ hour: 2015-08-21 00:11:45
6
+ advertiser: MyString
7
+ advertiser_id: 1
8
+ campaign: MyString
9
+ campaign_id: 1
10
+ banner: MyString
11
+ banner_id: 1
12
+ site: MyString
13
+ site_id: 1
14
+ zone: MyString
15
+ zone_id: 1
16
+ placement: MyString
17
+ placement_id: 1
18
+ channel: MyString
19
+ country: MyString
20
+ impressions: 1
21
+ clicks: 1
22
+ ctr: 1.5
23
+ conversions: 1
24
+ i2c: 1.5
25
+ ccr: 1.5
26
+ net: 1
27
+ gross: 1
28
+ profit: 1
29
+ ecpm_net: 1
30
+ ecpm_gross: 1
31
+ ecpm_profit: 1
32
+ status: MyString
33
+
34
+ two:
35
+ date: 2015-08-21
36
+ hour: 2015-08-21 00:11:45
37
+ advertiser: MyString
38
+ advertiser_id: 1
39
+ campaign: MyString
40
+ campaign_id: 1
41
+ banner: MyString
42
+ banner_id: 1
43
+ site: MyString
44
+ site_id: 1
45
+ zone: MyString
46
+ zone_id: 1
47
+ placement: MyString
48
+ placement_id: 1
49
+ channel: MyString
50
+ country: MyString
51
+ impressions: 1
52
+ clicks: 1
53
+ ctr: 1.5
54
+ conversions: 1
55
+ i2c: 1.5
56
+ ccr: 1.5
57
+ net: 1
58
+ gross: 1
59
+ profit: 1
60
+ ecpm_net: 1
61
+ ecpm_gross: 1
62
+ ecpm_profit: 1
63
+ status: MyString
@@ -10,4 +10,19 @@ one:
10
10
  banner_type: EXTERNAL_FILE
11
11
  ad_unit_id: 10
12
12
  ad_unit_width: 164
13
- ad_unit_height: 182
13
+ ad_unit_height: 182
14
+ campaign: one
15
+
16
+ two:
17
+ placement_type: SITE_PLACEMENT
18
+ campaign_id: 1247
19
+ weight: 1
20
+ image_banner_link: http://www.kewelta.com/images/imago_kewelta.png
21
+ url: http://www.kewelta.com
22
+ name: kewelta
23
+ banner_type: EXTERNAL_FILE
24
+ ad_unit_id: 10
25
+ ad_unit_width: 164
26
+ ad_unit_height: 182
27
+ campaign: two
28
+ epom_id: 2