h2ocube_rails_helper 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 76c7d94703c57273b111a9e6eda8fe4f4d12afcd
4
- data.tar.gz: e880eaeee479a42a0fc53a351f7d5cafeae0a1c0
3
+ metadata.gz: 8a0315a87423b0f6a62cf5ba453a5bcee0614b72
4
+ data.tar.gz: 8bad4332c3bcc040b60672b447b64c6d8888fe1a
5
5
  SHA512:
6
- metadata.gz: 4ce7f91d9df7a14ca2122e6730f26f14a22200c17e107f76586e5d5062b58049cc2f1ccf0746f6f1df97251e380569e06419a35160123acb9969999ff75c620c
7
- data.tar.gz: 78bc977c0160011b95a3ba27ec35f30165121a8278d0c41b45f0c9c908d2e70e4ca5a1698832314f4d93a9812779d2f20dc06d9b0944577835b953df5d9772e9
6
+ metadata.gz: 69a1e62c6c421a005c2c4584c8c3103f09a51f6591d2b219b8c99968b52274689cfca4cbbeaec28c5b9359593519c51f3716319cc4e17db3a379389eedc3f22b
7
+ data.tar.gz: 84cb7f2c5709019739de99b2b9870b544955a43a570b2419ed985c104b28475e8760e89d6a71893157cec3db3dfa62fd1ed0efa11e6547057cc0d7ac97fc4b09
data/.travis.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
+ - 2.0.0
4
5
  script: "bundle exec rake test"
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = 'h2ocube_rails_helper'
7
- gem.version = '0.0.13'
7
+ gem.version = '0.0.14'
8
8
  gem.authors = ['Ben']
9
9
  gem.email = ['ben@h2ocube.com']
10
10
  gem.description = %q{Just an helper collection}
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
15
15
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
16
16
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17
17
  gem.require_paths = ["lib"]
18
-
18
+
19
19
  gem.add_dependency 'settingslogic'
20
20
  gem.add_dependency 'rack-mobile-detect'
21
21
  end
@@ -39,7 +39,7 @@ end
39
39
  def _title opts = {}
40
40
  return [@_title] if defined?(@_title)
41
41
  if defined?(@title)
42
- title = @title.class.to_s == 'Array' ? @title : [ @title.strip ]
42
+ title = @title.class.to_s == 'Array' ? @title : [ @title.to_s.strip ]
43
43
  else
44
44
  if defined?(@item)
45
45
  if @item.respond_to?(:title) && !@item.title.blank?
@@ -69,7 +69,7 @@ def _keywords opts = {}
69
69
  else
70
70
  keywords = opts.has_key?(:keywords) ? opts[:keywords] : HelperSettings.keywords
71
71
  end
72
- [keywords].flatten.compact.map{ |k| k.strip.split(/(,|,)/) }.flatten.map{ |k| k.gsub(/(,|,)/, '').blank? ? nil : k }.compact.uniq
72
+ [keywords].flatten.compact.map{ |k| k.to_s.strip.split(/(,|,)/) }.flatten.map{ |k| k.gsub(/(,|,)/, '').blank? ? nil : k }.compact.uniq
73
73
  end
74
74
 
75
75
  def render_keywords opts = {}
@@ -103,10 +103,11 @@ end
103
103
 
104
104
  def render_ga opts = {}
105
105
  return '' if Rails.env.development?
106
- ga = opts[:ga] || HelperSettings.ga
106
+ ga = opts.has_key?(:ga) ? opts[:ga] : HelperSettings.ga
107
+ return '' if ga.nil?
107
108
  if defined?(Garelic)
108
109
  return ("<script>_gaq=[['_trackPageview'],['_trackPageLoadTime']];</script>" << Garelic.monitoring(ga)).html_safe
109
110
  else
110
111
  return "<script>var _gaq=[['_setAccount','#{ga}'],['_trackPageview'],['_trackPageLoadTime']];(function(){var ga=document.createElement('script');ga.type='text/javascript';ga.async=true;ga.src=('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(ga,s);})();</script>".html_safe
111
112
  end
112
- end
113
+ end
@@ -1,29 +1,36 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class RenderGaClass < ActionView::TestCase
4
- test 'simple' do
4
+ test 'default' do
5
5
  assert render_ga.include?('ga_code')
6
+ end
7
+
8
+ test 'with option' do
6
9
  assert render_ga(ga: '123').include?('123')
7
10
  end
11
+
12
+ test 'with nil' do
13
+ assert (render_ga(ga: nil) == '')
14
+ end
8
15
  end
9
16
 
10
17
  class HelperSettings
11
18
  def self.title
12
19
  'title'
13
20
  end
14
-
21
+
15
22
  def self.keywords
16
23
  'keywords'
17
24
  end
18
-
25
+
19
26
  def self.description
20
27
  'description'
21
28
  end
22
-
29
+
23
30
  def self.ga
24
31
  'ga_code'
25
32
  end
26
-
33
+
27
34
  def self.domain
28
35
  'domain'
29
36
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: h2ocube_rails_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-14 00:00:00.000000000 Z
11
+ date: 2013-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: settingslogic