ads-rails 0.0.6 → 0.0.8

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.
@@ -2,9 +2,54 @@ require 'test_helper'
2
2
 
3
3
  class IncludeTagTest < ActionDispatch::IntegrationTest
4
4
 
5
- test "should show include tag" do
6
- get '/'
7
- assert_response :success
5
+ test "should show adsense code if env is production and there is no renderer" do
6
+ assert ::Rails.application.config.ads.renderer.nil?
7
+ with_env 'production' do
8
+ get '/'
9
+ assert_response :success
10
+ assert response.body.include?("<script type=\"text/javascript\">google_ad_client = 'client';\ngoogle_ad_slot = 'slot';\ngoogle_ad_width = 728;\ngoogle_ad_height = 90;\n</script>")
11
+ assert response.body.include?('<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript">')
12
+ end
13
+ with_env 'production' do
14
+ https!
15
+ get '/'
16
+ assert_response :success
17
+ assert response.body.include?("<script type=\"text/javascript\">google_ad_client = 'client';\ngoogle_ad_slot = 'slot';\ngoogle_ad_width = 728;\ngoogle_ad_height = 90;\n</script>")
18
+ assert response.body.include?('<script src="https://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript">')
19
+ end
20
+ end
21
+
22
+ test "should show renderer output if env is not production and there is a renderer" do
23
+ with_env 'development' do
24
+ ::Rails.application.config.ads.renderer = lambda { |options| content_tag :script, "client = '#{options[:client]}';\nslot = '#{options[:slot]}';\nwidth = #{options[:width]};\nheight = #{options[:height]};".html_safe }
25
+ get '/'
26
+ assert_response :success
27
+ assert response.body.include?("<script>client = 'client';\nslot = 'slot';\nwidth = 728;\nheight = 90;</script>")
28
+ end
29
+ with_env 'development' do
30
+ ::Rails.application.config.ads.renderer = proc { |options| content_tag :script, "<script>client = '#{options[:client]}';\nslot = '#{options[:slot]}';\nwidth = #{options[:width]};\nheight = #{options[:height]};".html_safe }
31
+ get '/'
32
+ assert_response :success
33
+ assert response.body.include?("<script>client = 'client';\nslot = 'slot';\nwidth = 728;\nheight = 90;</script>")
34
+ end
35
+ end
36
+
37
+ test "should show gray div if env is not production and there is no renderer" do
38
+ assert ::Rails.application.config.ads.renderer.nil?
39
+ with_env 'development' do
40
+ get '/'
41
+ assert_response :success
42
+ assert response.body.include?('<div style="width:728px;height:90px;background:#c8c8c8;"></div>')
43
+ end
44
+ end
45
+
46
+ private
47
+
48
+ def with_env(value)
49
+ old_env = Rails.env
50
+ Rails.env = value
51
+ yield
52
+ Rails.env = old_env
8
53
  end
9
54
 
10
55
  end
metadata CHANGED
@@ -1,58 +1,60 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ads-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
- - Mattways
7
+ - Museways
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-21 00:00:00.000000000 Z
11
+ date: 2014-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 3.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sqlite3
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: Adds a simple view helper to create the google adsense include tag.
42
42
  email:
43
- - contact@mattways.com
43
+ - hello@museways.com
44
44
  executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
+ - MIT-LICENSE
49
+ - README.rdoc
50
+ - Rakefile
51
+ - lib/ads-rails.rb
52
+ - lib/ads/rails.rb
48
53
  - lib/ads/rails/action_view/base.rb
49
54
  - lib/ads/rails/railtie.rb
50
55
  - lib/ads/rails/version.rb
51
- - lib/ads/rails.rb
52
- - lib/ads-rails.rb
53
- - MIT-LICENSE
54
- - Rakefile
55
- - README.rdoc
56
+ - test/dummy/README.rdoc
57
+ - test/dummy/Rakefile
56
58
  - test/dummy/app/assets/javascripts/application.js
57
59
  - test/dummy/app/assets/stylesheets/application.css
58
60
  - test/dummy/app/controllers/application_controller.rb
@@ -63,6 +65,7 @@ files:
63
65
  - test/dummy/bin/bundle
64
66
  - test/dummy/bin/rails
65
67
  - test/dummy/bin/rake
68
+ - test/dummy/config.ru
66
69
  - test/dummy/config/application.rb
67
70
  - test/dummy/config/boot.rb
68
71
  - test/dummy/config/database.yml
@@ -79,7 +82,6 @@ files:
79
82
  - test/dummy/config/initializers/wrap_parameters.rb
80
83
  - test/dummy/config/locales/en.yml
81
84
  - test/dummy/config/routes.rb
82
- - test/dummy/config.ru
83
85
  - test/dummy/db/development.sqlite3
84
86
  - test/dummy/db/schema.rb
85
87
  - test/dummy/db/test.sqlite3
@@ -89,8 +91,12 @@ files:
89
91
  - test/dummy/public/422.html
90
92
  - test/dummy/public/500.html
91
93
  - test/dummy/public/favicon.ico
92
- - test/dummy/Rakefile
93
- - test/dummy/README.rdoc
94
+ - test/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705
95
+ - test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af
96
+ - test/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953
97
+ - test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994
98
+ - test/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6
99
+ - test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655
94
100
  - test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
95
101
  - test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af
96
102
  - test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953
@@ -99,7 +105,7 @@ files:
99
105
  - test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655
100
106
  - test/include_tag_test.rb
101
107
  - test/test_helper.rb
102
- homepage: https://github.com/mattways/ads-rails
108
+ homepage: https://github.com/museways/ads-rails
103
109
  licenses:
104
110
  - MIT
105
111
  metadata: {}
@@ -109,17 +115,17 @@ require_paths:
109
115
  - lib
110
116
  required_ruby_version: !ruby/object:Gem::Requirement
111
117
  requirements:
112
- - - '>='
118
+ - - ">="
113
119
  - !ruby/object:Gem::Version
114
120
  version: '0'
115
121
  required_rubygems_version: !ruby/object:Gem::Requirement
116
122
  requirements:
117
- - - '>='
123
+ - - ">="
118
124
  - !ruby/object:Gem::Version
119
125
  version: '0'
120
126
  requirements: []
121
127
  rubyforge_project:
122
- rubygems_version: 2.0.3
128
+ rubygems_version: 2.2.2
123
129
  signing_key:
124
130
  specification_version: 4
125
131
  summary: Google Adsense for Rails.
@@ -162,6 +168,12 @@ test_files:
162
168
  - test/dummy/public/favicon.ico
163
169
  - test/dummy/Rakefile
164
170
  - test/dummy/README.rdoc
171
+ - test/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705
172
+ - test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af
173
+ - test/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953
174
+ - test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994
175
+ - test/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6
176
+ - test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655
165
177
  - test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
166
178
  - test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af
167
179
  - test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953