ab_panel 0.1.0 → 0.1.1

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: 3ca41b9170ae4617dee1623e58c77c4964d71caa
4
- data.tar.gz: b0a191f70c30e6efd7521cfbfde7b0acf79872ca
3
+ metadata.gz: 67ea749f4f2e80710669492d90f163ace7311dd0
4
+ data.tar.gz: e6f8ffea1418b0c80754c011160a09accaeb8a3e
5
5
  SHA512:
6
- metadata.gz: bb555a360068bcbda0cd7242c97d93e58f2e81f55bf2752454bd5cd65a69bb8f92359e31e3807441e894a2bdcddb775aca292cc0ea5a9f9298c382536816baf7
7
- data.tar.gz: 05a0bc19937ba1266539051a49ec892369cdebd2b20c37fd19af6eb4bcd13f7367d87f424ce18352789e58814e1d76662fccdfa900409da77b4524ab561aa8e1
6
+ metadata.gz: ec2cffaf2212c588187af99829e85450cb82396229fa9cdeaa40d8c0b467b8f98068206b1720ed927ae48d7950a328c351161f2cce61f320e22dd63478a1fb2a
7
+ data.tar.gz: 351f325f654bd72fd5993cff00ea767873f7ba211091a4e718243a1fc7c7a66942477c5cc5b5b66bfa193b9133d8647dbad73a5ebfb4b5b1bbf0b1b8bc5701f1
data/.travis.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  language: ruby
2
+ script: 'bundle exec rspec spec'
2
3
  rvm:
3
4
  - 1.9.3
4
5
  - 2.0.0
@@ -50,6 +50,8 @@ module AbPanel
50
50
  AbPanel.reset!
51
51
  AbPanel.conditions = session['ab_panel_conditions']
52
52
  session['ab_panel_conditions'] = AbPanel.conditions
53
+ AbPanel.funnels = session['ab_panel_funnels']
54
+ session['ab_panel_funnels'] = AbPanel.funnels
53
55
 
54
56
  {
55
57
  'distinct_id' => distinct_id,
@@ -76,8 +78,7 @@ module AbPanel
76
78
  #
77
79
  # { 'course_id' => @course.id }
78
80
  def track_action(name, properties = {})
79
- funnel = properties.delete(:funnel)
80
- AbPanel.funnels << funnel if funnel.present?
81
+ AbPanel.add_funnel(properties.delete(:funnel))
81
82
 
82
83
  options = {
83
84
  distinct_id: distinct_id,
@@ -1,3 +1,3 @@
1
1
  module AbPanel
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/ab_panel.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'set'
1
2
  Dir[File.expand_path(File.join(
2
3
  File.dirname(__FILE__),'ab_panel','**','*.rb'))]
3
4
  .each {|f| require f}
@@ -52,7 +53,15 @@ module AbPanel
52
53
  end
53
54
 
54
55
  def funnels
55
- env['funnels'] ||= []
56
+ env['funnels'] ||= Set.new
57
+ end
58
+
59
+ def funnels=(funnels)
60
+ env['funnels'] = funnels
61
+ end
62
+
63
+ def add_funnel(funnel)
64
+ funnels.add(funnel) if funnel.present?
56
65
  end
57
66
 
58
67
  private # ----------------------------------------------------------------------------
@@ -11,8 +11,8 @@ end
11
11
  describe AbPanel::ControllerAdditions do
12
12
  let(:controller) { Controller.new }
13
13
 
14
- describe "#ab_panel_id" do
15
- subject { controller.ab_panel_id }
14
+ describe "#distinct_id" do
15
+ subject { controller.distinct_id }
16
16
 
17
17
  it { should match /^([A-Z]|[0-9])([A-Z]|[0-9])([A-Z]|[0-9])([A-Z]|[0-9])([A-Z]|[0-9])$/ }
18
18
  end
@@ -45,4 +45,32 @@ describe AbPanel do
45
45
  it { conditions.reject{|c| c}.size.should be 3 }
46
46
  end
47
47
  end
48
+
49
+ describe ".funnels" do
50
+ after do
51
+ AbPanel.funnels = nil
52
+ end
53
+
54
+ it 'adds a funnel' do
55
+ AbPanel.add_funnel('search')
56
+ AbPanel.funnels.to_a.should == ['search']
57
+ end
58
+
59
+ it 'only adds a funnel when present' do
60
+ AbPanel.add_funnel(nil)
61
+ AbPanel.funnels.to_a.should == []
62
+ end
63
+
64
+ it 'does not add a funnel twice' do
65
+ AbPanel.add_funnel('search')
66
+ AbPanel.add_funnel('search')
67
+ AbPanel.funnels.to_a.should == ['search']
68
+ end
69
+
70
+ it 'sets funnels' do
71
+ funnels = Set.new ['search', 'cta']
72
+ AbPanel.funnels = funnels
73
+ AbPanel.funnels.to_a.should == funnels.to_a
74
+ end
75
+ end
48
76
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ab_panel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wouter de Vos
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-10 00:00:00.000000000 Z
12
+ date: 2013-10-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler