analytics-ruby 1.1.0 → 2.0.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.
data/spec/module_spec.rb DELETED
@@ -1,136 +0,0 @@
1
- require 'analytics-ruby'
2
- require 'spec_helper'
3
-
4
- describe AnalyticsRuby do
5
-
6
- describe '#not-initialized' do
7
- it 'should ignore calls to track if not initialized' do
8
- expect { AnalyticsRuby.track({}) }.not_to raise_error
9
- end
10
-
11
- it 'should return false on track if not initialized' do
12
- AnalyticsRuby.track({}).should == false
13
- end
14
-
15
- it 'should ignore calls to identify if not initialized' do
16
- expect { AnalyticsRuby.identify({}) }.not_to raise_error
17
- end
18
-
19
- it 'should return false on identify if not initialized' do
20
- AnalyticsRuby.identify({}).should == false
21
- end
22
- end
23
-
24
- describe '#init' do
25
-
26
- it 'should successfully init' do
27
- AnalyticsRuby.init :secret => AnalyticsRubyHelpers::SECRET
28
- end
29
- end
30
-
31
- describe '#track' do
32
-
33
- it 'should error without an event' do
34
- expect { AnalyticsRuby.track :user_id => 'user' }.to raise_error(ArgumentError)
35
- end
36
-
37
- it 'should error without a user_id' do
38
- expect { AnalyticsRuby.track :event => 'Event' }.to raise_error(ArgumentError)
39
- end
40
-
41
- it 'should not error with the required options' do
42
- AnalyticsRuby.track AnalyticsRubyHelpers::Queued::TRACK
43
- sleep(1)
44
- end
45
- end
46
-
47
-
48
- describe '#identify' do
49
- it 'should error without a user_id' do
50
- expect { AnalyticsRuby.identify :traits => {} }.to raise_error(ArgumentError)
51
- end
52
-
53
- it 'should not error with the required options' do
54
- AnalyticsRuby.identify AnalyticsRubyHelpers::Queued::IDENTIFY
55
- sleep(1)
56
- end
57
- end
58
-
59
- describe '#alias' do
60
- it 'should error without from' do
61
- expect { AnalyticsRuby.alias :to => 1234 }.to raise_error(ArgumentError)
62
- end
63
-
64
- it 'should error without to' do
65
- expect { AnalyticsRuby.alias :from => 1234 }.to raise_error(ArgumentError)
66
- end
67
-
68
- it 'should not error with the required options' do
69
- AnalyticsRuby.alias AnalyticsRubyHelpers::ALIAS
70
- sleep(1)
71
- end
72
- end
73
-
74
- describe '#group' do
75
- it 'should error without group_id' do
76
- expect { AnalyticsRuby.group :user_id => 'foo' }.to raise_error(ArgumentError)
77
- end
78
-
79
- it 'should error without user_id' do
80
- expect { AnalyticsRuby.group :group_id => 'foo' }.to raise_error(ArgumentError)
81
- end
82
-
83
- it 'should not error with the required options' do
84
- AnalyticsRuby.group AnalyticsRubyHelpers::Queued::GROUP
85
- sleep(1)
86
- end
87
- end
88
-
89
- describe '#page' do
90
- it 'should error without user_id' do
91
- expect { AnalyticsRuby.page :name => 'foo' }.to raise_error(ArgumentError)
92
- end
93
-
94
- it 'should error without name' do
95
- expect { AnalyticsRuby.page :user_id => 1 }.to raise_error(ArgumentError)
96
- end
97
-
98
- it 'should not error with the required options' do
99
- AnalyticsRuby.page AnalyticsRubyHelpers::Queued::PAGE
100
- sleep(1)
101
- end
102
- end
103
-
104
- describe '#screen' do
105
- it 'should error without user_id' do
106
- expect { AnalyticsRuby.screen :name => 'foo' }.to raise_error(ArgumentError)
107
- end
108
-
109
- it 'should error without name' do
110
- expect { AnalyticsRuby.screen :user_id => 1 }.to raise_error(ArgumentError)
111
- end
112
-
113
- it 'should not error with the required options' do
114
- AnalyticsRuby.screen AnalyticsRubyHelpers::Queued::SCREEN
115
- sleep(1)
116
- end
117
- end
118
-
119
- describe '#flush' do
120
-
121
- it 'should flush without error' do
122
- AnalyticsRuby.identify AnalyticsRubyHelpers::Queued::IDENTIFY
123
- AnalyticsRuby.flush
124
- end
125
- end
126
-
127
- describe "#initialized?" do
128
-
129
- context "when initialized" do
130
- it "should return true" do
131
- AnalyticsRuby.init :secret => AnalyticsRubyHelpers::SECRET
132
- expect(AnalyticsRuby.initialized?).to be_true
133
- end
134
- end
135
- end
136
- end