gaq 0.2.0 → 0.2.1

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.
@@ -0,0 +1,4 @@
1
+ SimpleCov.start do
2
+ add_filter "/spec-dummy/"
3
+ add_filter "/spec/"
4
+ end
data/Gemfile CHANGED
@@ -3,8 +3,10 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in gaq.gemspec
4
4
  gemspec
5
5
 
6
+ gem 'rspec-expectations', '~> 2.13.0'
7
+
6
8
  gem 'rails', '~> 3.1.0'
7
- gem 'rspec-rails', '~> 2.13.2'
9
+ gem 'rspec-rails'
8
10
 
9
11
  gem 'capybara', '~> 2.0.0'
10
12
  gem 'terminal-notifier-guard'
@@ -12,4 +14,6 @@ gem 'rb-fsevent' # used by guard for watching
12
14
  gem 'guard-rspec'
13
15
  gem 'debugger'
14
16
 
15
- gem 'nokogiri'
17
+ gem 'nokogiri'
18
+
19
+ gem 'coveralls', require: false
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Gaq
1
+ # Gaq [![Code Climate](https://codeclimate.com/github/schnittchen/gaq.png)](https://codeclimate.com/github/schnittchen/gaq) [![Build Status](https://travis-ci.org/schnittchen/gaq.png)](https://travis-ci.org/schnittchen/gaq) [![Coverage Status](https://coveralls.io/repos/schnittchen/gaq/badge.png?branch=master)](https://coveralls.io/r/schnittchen/gaq?branch=master)
2
2
 
3
3
  Ever wanted to push a track event from a controller? Set a custom variable from model data? Now you can.
4
4
 
data/Rakefile CHANGED
@@ -1 +1,37 @@
1
- require "bundler/gem_tasks"
1
+ require 'rake'
2
+ require 'bundler/gem_tasks'
3
+ require 'rspec/core/rake_task'
4
+
5
+ require 'coveralls/rake/task'
6
+ Coveralls::RakeTask.new
7
+
8
+ task "default" => [:ci, 'coveralls:push']
9
+
10
+ desc "Run all tests for CI"
11
+ task "ci" => "spec"
12
+
13
+ desc "Run all specs"
14
+ task "spec" => "spec:all"
15
+
16
+ namespace "spec" do
17
+ task "all" => ["gaq", "static", "dynamic"]
18
+
19
+ desc "Run gaq specs"
20
+ RSpec::Core::RakeTask.new("gaq") do |t|
21
+ t.rspec_opts = "-r ./spec/coveralls_helper"
22
+ end
23
+
24
+ desc "Run static specs"
25
+ RSpec::Core::RakeTask.new("static") do |t|
26
+ ENV['RAILS_ENV'] = 'test_static'
27
+ t.pattern = "spec-dummy/spec/**/*_spec.rb"
28
+ t.rspec_opts = "-I spec-dummy/spec --tag ~dynamic"
29
+ end
30
+
31
+ desc "Run dynamic specs"
32
+ RSpec::Core::RakeTask.new("dynamic") do |t|
33
+ ENV['RAILS_ENV'] = 'test_dynamic'
34
+ t.pattern = "spec-dummy/spec/**/*_spec.rb"
35
+ t.rspec_opts = "-I spec-dummy/spec --tag ~static"
36
+ end
37
+ end
@@ -44,6 +44,8 @@ module Gaq
44
44
  @tracker_configs = { nil => default_tracker_config }
45
45
  @rails_config = RailsConfig.new(self, default_tracker_config)
46
46
  @variables = {}
47
+
48
+ self.render_ga_js = :production
47
49
  end
48
50
 
49
51
  def declare_variable(name, options = {})
@@ -1,3 +1,3 @@
1
1
  module Gaq
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe "dynamic config interpretation", dynamic: true do
4
+ it "runs this test with the correct rails env" do
5
+ Rails.env.should be == 'test_dynamic'
6
+ end
7
+ end
8
+
9
+ describe "dynamic config interpretation", static: true do
10
+ it "runs this test with the correct rails env" do
11
+ Rails.env.should be == 'test_static'
12
+ end
13
+ end
@@ -5,6 +5,13 @@ require 'rspec/rails'
5
5
  require 'rspec/autorun'
6
6
  require 'capybara/rails'
7
7
 
8
+
9
+ require 'simplecov'
10
+ require 'coveralls'
11
+
12
+ SimpleCov.command_name Rails.env
13
+ SimpleCov.start
14
+
8
15
  # Requires supporting ruby files with custom matchers and macros, etc,
9
16
  # in spec/support/ and its subdirectories.
10
17
  Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
@@ -0,0 +1,5 @@
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+
4
+ SimpleCov.command_name 'gaq'
5
+ SimpleCov.start
@@ -174,6 +174,12 @@ module Gaq
174
174
  end
175
175
  end
176
176
 
177
+ describe "#render_ga_js" do
178
+ it "equals :production by default" do
179
+ subject.render_ga_js.should be :production
180
+ end
181
+ end
182
+
177
183
  describe "#render_ga_js?" do
178
184
  let(:environment) do
179
185
  ActiveSupport::StringInquirer.new(example.metadata[:env].to_s)
@@ -191,6 +197,20 @@ module Gaq
191
197
  end
192
198
  end
193
199
 
200
+ context "without using rails_config.render_ga_js=" do
201
+ it "returns true in production", env: :production do
202
+ result.should be == true
203
+ end
204
+
205
+ it "returns false in development", env: :development do
206
+ result.should be == false
207
+ end
208
+
209
+ it "returns false in test", env: :test do
210
+ result.should be == false
211
+ end
212
+ end
213
+
194
214
  context "with rails_config.render_ga_js = true or false" do
195
215
  it "reports those values " do
196
216
  rails.render_ga_js = true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gaq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-24 00:00:00.000000000 Z
12
+ date: 2013-07-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -52,6 +52,7 @@ extensions: []
52
52
  extra_rdoc_files: []
53
53
  files:
54
54
  - .gitignore
55
+ - .simplecov
55
56
  - Gemfile
56
57
  - Guardfile
57
58
  - LICENSE.txt
@@ -110,7 +111,9 @@ files:
110
111
  - spec-dummy/spec/features/dynamic_config_spec.rb
111
112
  - spec-dummy/spec/features/next_request_spec.rb
112
113
  - spec-dummy/spec/features/presence_spec.rb
114
+ - spec-dummy/spec/features/static_dynamic_spec.rb
113
115
  - spec-dummy/spec/spec_helper.rb
116
+ - spec/coveralls_helper.rb
114
117
  - spec/lib/gaq/class_cache_spec.rb
115
118
  - spec/lib/gaq/command_language_spec.rb
116
119
  - spec/lib/gaq/configuration_spec.rb
@@ -147,6 +150,7 @@ specification_version: 3
147
150
  summary: Renders _gaq initialization and the ga.js snippet. Supports pushing from
148
151
  the back end
149
152
  test_files:
153
+ - spec/coveralls_helper.rb
150
154
  - spec/lib/gaq/class_cache_spec.rb
151
155
  - spec/lib/gaq/command_language_spec.rb
152
156
  - spec/lib/gaq/configuration_spec.rb