vero 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,76 +1,74 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Vero::Config do
4
- before :each do
5
- @config = Vero::Config.new
6
- end
4
+ let(:config) { Vero::Config.new }
7
5
 
8
6
  it "should be async by default" do
9
- @config.async.should be(true)
7
+ expect(config.async).to be(true)
10
8
  end
11
9
 
12
10
  describe :reset! do
13
11
  it "should reset all attributes" do
14
- @config.api_key = "abcd1234"
15
- @config.secret = "abcd1234"
12
+ config.api_key = "abcd1234"
13
+ config.secret = "abcd1234"
14
+ config.reset!
16
15
 
17
- @config.reset!
18
- @config.api_key.should be_nil
19
- @config.secret.should be_nil
16
+ expect(config.api_key).to be_nil
17
+ expect(config.secret).to be_nil
20
18
  end
21
19
  end
22
20
 
23
21
  describe :auth_token do
24
22
  it "should return nil if either api_key or secret are not set" do
25
- @config.api_key = nil
26
- @config.secret = "abcd"
27
- @config.auth_token.should be_nil
23
+ config.api_key = nil
24
+ config.secret = "abcd"
25
+ expect(config.auth_token).to be_nil
28
26
 
29
- @config.api_key = "abcd"
30
- @config.secret = nil
31
- @config.auth_token.should be_nil
27
+ config.api_key = "abcd"
28
+ config.secret = nil
29
+ expect(config.auth_token).to be_nil
32
30
 
33
- @config.api_key = "abcd"
34
- @config.secret = "abcd"
35
- @config.auth_token.should_not be_nil
31
+ config.api_key = "abcd"
32
+ config.secret = "abcd"
33
+ expect(config.auth_token).not_to be_nil
36
34
  end
37
35
 
38
36
  it "should return an expected auth_token" do
39
- @config.api_key = "abcd1234"
40
- @config.secret = "efgh5678"
41
- @config.auth_token.should == "YWJjZDEyMzQ6ZWZnaDU2Nzg="
37
+ config.api_key = "abcd1234"
38
+ config.secret = "efgh5678"
39
+ expect(config.auth_token).to eq("YWJjZDEyMzQ6ZWZnaDU2Nzg=")
42
40
  end
43
41
  end
44
42
 
45
43
  describe :request_params do
46
44
  it "should return a hash of auth_token and development_mode if they are set" do
47
- @config.api_key = nil
48
- @config.secret = nil
49
- @config.development_mode = nil
50
- @config.request_params.should == {}
45
+ config.api_key = nil
46
+ config.secret = nil
47
+ config.development_mode = nil
48
+ expect(config.request_params).to eq({})
51
49
 
52
- @config.api_key = "abcd1234"
53
- @config.secret = "abcd1234"
54
- @config.request_params.should == {:auth_token => "YWJjZDEyMzQ6YWJjZDEyMzQ="}
50
+ config.api_key = "abcd1234"
51
+ config.secret = "abcd1234"
52
+ expect(config.request_params).to eq({:auth_token => "YWJjZDEyMzQ6YWJjZDEyMzQ="})
55
53
 
56
- @config.development_mode = true
57
- @config.request_params.should == {:auth_token => "YWJjZDEyMzQ6YWJjZDEyMzQ=", :development_mode => true}
54
+ config.development_mode = true
55
+ expect(config.request_params).to eq({:auth_token => "YWJjZDEyMzQ6YWJjZDEyMzQ=", :development_mode => true})
58
56
  end
59
57
  end
60
58
 
61
59
  describe :domain do
62
60
  it "should return https://api.getvero.com when not set" do
63
- @config.domain.should == 'https://api.getvero.com'
64
- @config.domain = 'blah.com'
65
- @config.domain.should_not == 'https://api.getvero.com'
61
+ expect(config.domain).to eq('https://api.getvero.com')
62
+ config.domain = 'blah.com'
63
+ expect(config.domain).not_to eq('https://api.getvero.com')
66
64
  end
67
65
 
68
66
  it "should return the domain value" do
69
- @config.domain = 'test.unbelieveable.com.au'
70
- @config.domain.should == 'http://test.unbelieveable.com.au'
67
+ config.domain = 'test.unbelieveable.com.au'
68
+ expect(config.domain).to eq('http://test.unbelieveable.com.au')
71
69
 
72
- @config.domain = 'http://test.unbelieveable.com.au'
73
- @config.domain.should == 'http://test.unbelieveable.com.au'
70
+ config.domain = 'http://test.unbelieveable.com.au'
71
+ expect(config.domain).to eq('http://test.unbelieveable.com.au')
74
72
  end
75
73
  end
76
74
 
@@ -78,26 +76,36 @@ describe Vero::Config do
78
76
  it "by default it should return false regardless of Rails environment" do
79
77
  stub_env('development') {
80
78
  config = Vero::Config.new
81
- config.development_mode.should be(false)
79
+ expect(config.development_mode).to be(false)
82
80
  }
83
81
 
84
82
  stub_env('test') {
85
83
  config = Vero::Config.new
86
- config.development_mode.should be(false)
84
+ expect(config.development_mode).to be(false)
87
85
  }
88
86
 
89
87
  stub_env('production') {
90
88
  config = Vero::Config.new
91
- config.development_mode.should be(false)
89
+ expect(config.development_mode).to be(false)
92
90
  }
93
91
  end
94
92
 
95
93
  it "can be overritten with the config block" do
96
- @config.development_mode = true
97
- @config.request_params[:development_mode].should be(true)
94
+ config.development_mode = true
95
+ expect(config.request_params[:development_mode]).to be(true)
96
+
97
+ config.reset!
98
+ expect(config.request_params[:development_mode]).to be(false)
99
+ end
100
+ end
101
+
102
+ describe :test_mode do
103
+ it 'should not raise error even though not configured properly' do
104
+ input = {:event_name => "test_event"}
105
+ mock_context = Vero::Context.new
106
+ allow(mock_context.config).to receive(:configured?).and_return(false)
98
107
 
99
- @config.reset!
100
- @config.request_params[:development_mode].should be(false)
108
+ expect { Vero::Api::Events.track!(input) }.to_not raise_error
101
109
  end
102
110
  end
103
111
  end
@@ -5,53 +5,53 @@ describe Vero::Context do
5
5
 
6
6
  it "accepts multiple parameter types in contructor" do
7
7
  context1 = Vero::Context.new({ :api_key => 'blah', :secret => 'didah' })
8
- context1.should be_a(Vero::Context)
9
- context1.config.api_key.should == 'blah'
10
- context1.config.secret.should == 'didah'
8
+ expect(context1).to be_a(Vero::Context)
9
+ expect(context1.config.api_key).to eq('blah')
10
+ expect(context1.config.secret).to eq('didah')
11
11
 
12
12
  context2 = Vero::Context.new(context1)
13
- context2.should be_a(Vero::Context)
14
- context2.should_not be(context1)
15
- context2.config.api_key.should == 'blah'
16
- context2.config.secret.should == 'didah'
13
+ expect(context2).to be_a(Vero::Context)
14
+ expect(context2).not_to be(context1)
15
+ expect(context2.config.api_key).to eq('blah')
16
+ expect(context2.config.secret).to eq('didah')
17
17
 
18
18
  context3 = Vero::Context.new VeroUser.new('api_key', 'secret')
19
- context3.should be_a(Vero::Context)
20
- context3.config.api_key.should == 'api_key'
21
- context3.config.secret.should == 'secret'
19
+ expect(context3).to be_a(Vero::Context)
20
+ expect(context3.config.api_key).to eq('api_key')
21
+ expect(context3.config.secret).to eq('secret')
22
22
  end
23
23
 
24
24
  describe :configure do
25
25
  it "should ignore configuring the config if no block is provided" do
26
26
  context.configure
27
- context.configured?.should be(false)
27
+ expect(context.configured?).to be(false)
28
28
  end
29
29
 
30
30
  it "should pass configuration defined in the block to the config file" do
31
31
  context.configure do |c|
32
32
  c.api_key = "abcd1234"
33
33
  end
34
- context.config.api_key.should == "abcd1234"
34
+ expect(context.config.api_key).to eq("abcd1234")
35
35
  end
36
36
 
37
37
  it "should init should be able to set async" do
38
38
  context.configure do |c|
39
39
  c.async = false
40
40
  end
41
- context.config.async.should be(false)
41
+ expect(context.config.async).to be(false)
42
42
 
43
43
  context.configure do |c|
44
44
  c.async = true
45
45
  end
46
- context.config.async.should be(true)
46
+ expect(context.config.async).to be(true)
47
47
  end
48
48
  end
49
49
 
50
50
  describe :disable_requests! do
51
51
  it "should change config.disabled" do
52
- context.config.disabled.should be(false)
52
+ expect(context.config.disabled).to be(false)
53
53
  context.disable_requests!
54
- context.config.disabled.should be(true)
54
+ expect(context.config.disabled).to be(true)
55
55
  end
56
56
  end
57
57
  end
@@ -5,7 +5,7 @@ describe Vero::Sender do
5
5
 
6
6
  describe ".senders" do
7
7
  it "should be a Hash" do
8
- subject.senders.should be_a(Hash)
8
+ expect(subject.senders).to be_a(Hash)
9
9
  end
10
10
 
11
11
  context 'when using Ruby with verion greater than 1.8.7' do
@@ -14,20 +14,21 @@ describe Vero::Sender do
14
14
  end
15
15
 
16
16
  it "should have a default set of senders (true, false, none, thread)" do
17
- subject.senders.should == {
17
+ expect(subject.senders).to eq({
18
18
  true => Vero::Senders::Thread,
19
19
  false => Vero::Senders::Base,
20
20
  :none => Vero::Senders::Base,
21
21
  :thread => Vero::Senders::Thread,
22
- }
22
+ })
23
23
  end
24
24
  end
25
25
 
26
26
  it "should automatically find senders that are not defined" do
27
- subject.senders[:delayed_job].should == Vero::Senders::DelayedJob
28
- subject.senders[:resque].should == Vero::Senders::Resque
29
- subject.senders[:invalid].should == Vero::Senders::Invalid
30
- subject.senders[:none].should == Vero::Senders::Base
27
+ expect(subject.senders[:delayed_job]).to eq(Vero::Senders::DelayedJob)
28
+ expect(subject.senders[:resque]).to eq(Vero::Senders::Resque)
29
+ expect(subject.senders[:sidekiq]).to eq(Vero::Senders::Sidekiq)
30
+ expect(subject.senders[:invalid]).to eq(Vero::Senders::Invalid)
31
+ expect(subject.senders[:none]).to eq(Vero::Senders::Base)
31
32
  end
32
33
  end
33
34
  end
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe Vero::Senders::Sidekiq do
4
+ subject { Vero::Senders::Sidekiq.new }
5
+ describe :call do
6
+ it "should perform_async a Vero::SidekiqWorker" do
7
+ Vero::SidekiqWorker.should_receive(:perform_async).with('Vero::Api::Workers::Events::TrackAPI', "abc", {:test => "abc"}).once
8
+ subject.call(Vero::Api::Workers::Events::TrackAPI, "abc", {:test => "abc"})
9
+ end
10
+ end
11
+ end
12
+
13
+ describe Vero::SidekiqWorker do
14
+ subject { Vero::SidekiqWorker.new }
15
+ describe :perform do
16
+ it "should call the api method" do
17
+ mock_api = double(Vero::Api::Workers::Events::TrackAPI)
18
+ mock_api.should_receive(:perform).once
19
+ Vero::Api::Workers::Events::TrackAPI.stub(:new).and_return(mock_api)
20
+ Vero::Api::Workers::Events::TrackAPI.should_receive(:new).with("abc", {:test => "abc"}).once
21
+
22
+ subject.perform('Vero::Api::Workers::Events::TrackAPI', "abc", {:test => "abc"})
23
+ end
24
+ end
25
+ end
@@ -16,7 +16,7 @@ describe Vero::Trackable do
16
16
  :event_name => 'test_event',
17
17
  :auth_token => 'YWJjZDEyMzQ6ZWZnaDU2Nzg=',
18
18
  :identity => {:email => 'durkster@gmail.com', :age => 20, :_user_type => "User"},
19
- :data => { :test => 1 },
19
+ :data => {:test => 1},
20
20
  :development_mode => true
21
21
  }
22
22
  @url = "https://api.getvero.com/api/v1/track.json"
@@ -28,10 +28,10 @@ describe Vero::Trackable do
28
28
  context "the gem has not been configured" do
29
29
  before { Vero::App.reset! }
30
30
  it "should raise an error when API requests are made" do
31
- expect { @user.track(@request_params[:event_name], @request_params[:data]) }.to raise_error
31
+ expect { @user.track(@request_params[:event_name], @request_params[:data]) }.to raise_error(RuntimeError)
32
32
 
33
- @user.stub(:post_later).and_return('success')
34
- expect { @user.identity! }.to raise_error
33
+ allow(@user).to receive(:post_later).and_return('success')
34
+ expect { @user.identity! }.to raise_error(NoMethodError)
35
35
  end
36
36
  end
37
37
 
@@ -56,38 +56,38 @@ describe Vero::Trackable do
56
56
  end
57
57
 
58
58
  it "should not send a track request when the required parameters are invalid" do
59
- expect { @user.track!(nil) }.to raise_error
60
- expect { @user.track!('') }.to raise_error
61
- expect { @user.track!('test', '') }.to raise_error
59
+ expect { @user.track!(nil) }.to raise_error(ArgumentError)
60
+ expect { @user.track!('') }.to raise_error(ArgumentError)
61
+ expect { @user.track!('test', '') }.to raise_error(ArgumentError)
62
62
  end
63
63
 
64
64
  it "should send a `track!` request when async is set to false" do
65
65
  context = vero_context(@user)
66
- @user.stub(:with_vero_context).and_return(context)
66
+ allow(@user).to receive(:with_vero_context).and_return(context)
67
67
 
68
- RestClient.stub(:post).and_return(200)
68
+ allow(RestClient).to receive(:post).and_return(200)
69
69
 
70
- Vero::Api::Events.stub(:track!).and_return(200)
71
- Vero::Api::Events.should_receive(:track!).with(@request_params, context)
72
- @user.track!(@request_params[:event_name], @request_params[:data]).should == 200
70
+ allow(Vero::Api::Events).to receive(:track!).and_return(200)
71
+ expect(Vero::Api::Events).to receive(:track!).with(@request_params, context)
72
+ expect(@user.track!(@request_params[:event_name], @request_params[:data])).to eq(200)
73
73
 
74
- Vero::Api::Events.stub(:track!).and_return(200)
75
- Vero::Api::Events.should_receive(:track!).with(@request_params.merge(:data => {}), context)
76
- @user.track!(@request_params[:event_name]).should == 200
74
+ allow(Vero::Api::Events).to receive(:track!).and_return(200)
75
+ expect(Vero::Api::Events).to receive(:track!).with(@request_params.merge(:data => {}), context)
76
+ expect(@user.track!(@request_params[:event_name])).to eq(200)
77
77
  end
78
78
 
79
79
  context 'when set to be async' do
80
80
  before do
81
81
  @context = vero_context(@user, true, true)
82
- @user.stub(:with_vero_context).and_return(@context)
82
+ allow(@user).to receive(:with_vero_context).and_return(@context)
83
83
  end
84
84
 
85
85
  context 'not using Ruby 1.8.7' do
86
86
  before { stub_const('RUBY_VERSION', '1.9.3') }
87
87
 
88
88
  it 'sends' do
89
- @user.track!(@request_params[:event_name], @request_params[:data]).should be_nil
90
- @user.track!(@request_params[:event_name]).should be_nil
89
+ expect(@user.track!(@request_params[:event_name], @request_params[:data])).to be_nil
90
+ expect(@user.track!(@request_params[:event_name])).to be_nil
91
91
  end
92
92
  end
93
93
  end
@@ -105,25 +105,25 @@ describe Vero::Trackable do
105
105
 
106
106
  it "should send an `identify` request when async is set to false" do
107
107
  context = vero_context(@user)
108
- @user.stub(:with_vero_context).and_return(context)
108
+ allow(@user).to receive(:with_vero_context).and_return(context)
109
109
 
110
- Vero::Api::Users.stub(:track!).and_return(200)
111
- Vero::Api::Users.should_receive(:track!).with(@request_params, context)
110
+ allow(Vero::Api::Users).to receive(:track!).and_return(200)
111
+ expect(Vero::Api::Users).to receive(:track!).with(@request_params, context)
112
112
 
113
- @user.identify!.should == 200
113
+ expect(@user.identify!).to eq(200)
114
114
  end
115
115
 
116
116
  context 'when set to use async' do
117
117
  before do
118
118
  @context = vero_context(@user, false, true)
119
- @user.stub(:with_vero_context).and_return(@context)
119
+ allow(@user).to receive(:with_vero_context).and_return(@context)
120
120
  end
121
121
 
122
122
  context 'and not using Ruby 1.8.7' do
123
123
  before { stub_const('RUBY_VERSION', '1.9.3') }
124
124
 
125
125
  it 'sends' do
126
- @user.identify!.should be_nil
126
+ expect(@user.identify!).to be_nil
127
127
  end
128
128
  end
129
129
  end
@@ -143,18 +143,18 @@ describe Vero::Trackable do
143
143
  context = Vero::Context.new(Vero::App.default_context)
144
144
  context.subject = @user
145
145
 
146
- @user.stub(:with_vero_context).and_return(context)
146
+ allow(@user).to receive(:with_vero_context).and_return(context)
147
147
 
148
- Vero::Api::Users.stub(:edit_user!).and_return(200)
149
- Vero::Api::Users.should_receive(:edit_user!).with(@request_params, context)
148
+ allow(Vero::Api::Users).to receive(:edit_user!).and_return(200)
149
+ expect(Vero::Api::Users).to receive(:edit_user!).with(@request_params, context)
150
150
 
151
- @user.with_vero_context.update_user!.should == 200
151
+ expect(@user.with_vero_context.update_user!).to eq(200)
152
152
  end
153
153
 
154
154
  context 'when set to use async' do
155
155
  before do
156
156
  @context = vero_context(@user, false, true)
157
- @user.stub(:with_vero_context).and_return(@context)
157
+ allow(@user).to receive(:with_vero_context).and_return(@context)
158
158
  end
159
159
 
160
160
  context 'and using Ruby 1.8.7' do
@@ -162,7 +162,7 @@ describe Vero::Trackable do
162
162
 
163
163
  it 'raises an error' do
164
164
  @context.config.disabled = false
165
- expect { @user.with_vero_context.update_user! }.to raise_error
165
+ expect { @user.with_vero_context.update_user! }.to raise_error(RuntimeError)
166
166
  end
167
167
  end
168
168
 
@@ -170,7 +170,7 @@ describe Vero::Trackable do
170
170
  before { stub_const('RUBY_VERSION', '1.9.3') }
171
171
 
172
172
  it 'sends' do
173
- @user.with_vero_context.update_user!.should be_nil
173
+ expect(@user.with_vero_context.update_user!).to be_nil
174
174
  end
175
175
  end
176
176
  end
@@ -192,12 +192,12 @@ describe Vero::Trackable do
192
192
  context.subject = @user
193
193
  context.config.async = false
194
194
 
195
- @user.stub(:with_vero_context).and_return(context)
195
+ allow(@user).to receive(:with_vero_context).and_return(context)
196
196
 
197
- Vero::Api::Users.stub(:edit_user_tags!).and_return(200)
198
- Vero::Api::Users.should_receive(:edit_user_tags!).with(@request_params, context)
197
+ allow(Vero::Api::Users).to receive(:edit_user_tags!).and_return(200)
198
+ expect(Vero::Api::Users).to receive(:edit_user_tags!).with(@request_params, context)
199
199
 
200
- @user.with_vero_context.update_user_tags!.should == 200
200
+ expect(@user.with_vero_context.update_user_tags!).to eq(200)
201
201
  end
202
202
 
203
203
  if RUBY_VERSION =~ /1\.9\./
@@ -206,9 +206,9 @@ describe Vero::Trackable do
206
206
  context.subject = @user
207
207
  context.config.async = true
208
208
 
209
- @user.stub(:with_vero_context).and_return(context)
209
+ allow(@user).to receive(:with_vero_context).and_return(context)
210
210
 
211
- @user.with_vero_context.update_user_tags!.should be_nil
211
+ expect(@user.with_vero_context.update_user_tags!).to be_nil
212
212
  end
213
213
  end
214
214
  end
@@ -227,25 +227,25 @@ describe Vero::Trackable do
227
227
  context.subject = @user
228
228
  context.config.async = false
229
229
 
230
- @user.stub(:with_vero_context).and_return(context)
230
+ allow(@user).to receive(:with_vero_context).and_return(context)
231
231
 
232
- Vero::Api::Users.stub(:unsubscribe!).and_return(200)
233
- Vero::Api::Users.should_receive(:unsubscribe!).with(@request_params, context)
232
+ allow(Vero::Api::Users).to receive(:unsubscribe!).and_return(200)
233
+ expect(Vero::Api::Users).to receive(:unsubscribe!).with(@request_params, context)
234
234
 
235
- @user.with_vero_context.unsubscribe!.should == 200
235
+ expect(@user.with_vero_context.unsubscribe!).to eq(200)
236
236
  end
237
237
 
238
238
  context 'when using async' do
239
239
  before do
240
240
  @context = vero_context(@user, false, true)
241
- @user.stub(:with_vero_context).and_return(@context)
241
+ allow(@user).to receive(:with_vero_context).and_return(@context)
242
242
  end
243
243
 
244
244
  context 'and using Ruby 1.9.3' do
245
245
  before { stub_const('RUBY_VERSION', '1.9.3') }
246
246
 
247
247
  it 'sends' do
248
- @user.with_vero_context.unsubscribe!.should be_nil
248
+ expect(@user.with_vero_context.unsubscribe!).to be_nil
249
249
  end
250
250
  end
251
251
  end
@@ -256,18 +256,18 @@ describe Vero::Trackable do
256
256
 
257
257
  it "should build an array of trackable params" do
258
258
  User.trackable :email, :age
259
- User.trackable_map.should == [:email, :age]
259
+ expect(User.trackable_map).to eq([:email, :age])
260
260
  end
261
261
 
262
262
  it "should append new trackable items to an existing trackable map" do
263
263
  User.trackable :email, :age
264
264
  User.trackable :hair_colour
265
- User.trackable_map.should == [:email, :age, :hair_colour]
265
+ expect(User.trackable_map).to eq([:email, :age, :hair_colour])
266
266
  end
267
267
 
268
268
  it "should append an extra's hash to the trackable map" do
269
269
  User.trackable :email, {:extras => :properties}
270
- User.trackable_map.should == [:email, {:extras => :properties}]
270
+ expect(User.trackable_map).to eq([:email, {:extras => :properties}])
271
271
  end
272
272
  end
273
273
 
@@ -279,54 +279,54 @@ describe Vero::Trackable do
279
279
 
280
280
  it "should return a hash of all values mapped by trackable" do
281
281
  user = User.new
282
- user.to_vero.should == {:email => 'durkster@gmail.com', :age => 20, :_user_type => "User"}
282
+ expect(user.to_vero).to eq({:email => 'durkster@gmail.com', :age => 20, :_user_type => "User"})
283
283
 
284
284
  user = UserWithoutEmail.new
285
- user.to_vero.should == {:email => 'durkster@gmail.com', :age => 20, :_user_type => "UserWithoutEmail"}
285
+ expect(user.to_vero).to eq({:email => 'durkster@gmail.com', :age => 20, :_user_type => "UserWithoutEmail"})
286
286
 
287
287
  user = UserWithEmailAddress.new
288
- user.to_vero.should == {:email => 'durkster@gmail.com', :age => 20, :_user_type => "UserWithEmailAddress"}
288
+ expect(user.to_vero).to eq({:email => 'durkster@gmail.com', :age => 20, :_user_type => "UserWithEmailAddress"})
289
289
 
290
290
  user = UserWithoutInterface.new
291
- user.to_vero.should == {:email => 'durkster@gmail.com', :age => 20, :_user_type => "UserWithoutInterface"}
291
+ expect(user.to_vero).to eq({:email => 'durkster@gmail.com', :age => 20, :_user_type => "UserWithoutInterface"})
292
292
 
293
293
  user = UserWithNilAttributes.new
294
- user.to_vero.should == {:email => 'durkster@gmail.com', :_user_type => "UserWithNilAttributes"}
294
+ expect(user.to_vero).to eq({:email => 'durkster@gmail.com', :_user_type => "UserWithNilAttributes"})
295
295
  end
296
296
 
297
297
  it "should take into account any defined extras" do
298
298
  user = UserWithExtras.new
299
299
  user.properties = nil
300
- user.to_vero.should == {:email => 'durkster@gmail.com', :_user_type => "UserWithExtras"}
300
+ expect(user.to_vero).to eq({:email => 'durkster@gmail.com', :_user_type => "UserWithExtras"})
301
301
 
302
302
  user.properties = "test"
303
- user.to_vero.should == {:email => 'durkster@gmail.com', :_user_type => "UserWithExtras"}
303
+ expect(user.to_vero).to eq({:email => 'durkster@gmail.com', :_user_type => "UserWithExtras"})
304
304
 
305
305
  user.properties = {}
306
- user.to_vero.should == {:email => 'durkster@gmail.com', :_user_type => "UserWithExtras"}
306
+ expect(user.to_vero).to eq({:email => 'durkster@gmail.com', :_user_type => "UserWithExtras"})
307
307
 
308
308
  user.properties = {
309
309
  :age => 20,
310
310
  :gender => "female"
311
311
  }
312
- user.to_vero.should == {:email => 'durkster@gmail.com', :age => 20, :gender => "female", :_user_type => "UserWithExtras"}
312
+ expect(user.to_vero).to eq({:email => 'durkster@gmail.com', :age => 20, :gender => "female", :_user_type => "UserWithExtras"})
313
313
 
314
314
  user = UserWithPrivateExtras.new
315
- user.to_vero.should == {:email => 'durkster@gmail.com', :age => 26, :_user_type => "UserWithPrivateExtras"}
315
+ expect(user.to_vero).to eq({:email => 'durkster@gmail.com', :age => 26, :_user_type => "UserWithPrivateExtras"})
316
316
  end
317
317
 
318
318
  it "should allow extras to be provided instead :id or :email" do
319
319
  user = UserWithOnlyExtras.new
320
320
  user.properties = {:email => user.email}
321
- user.to_vero.should == {:email => 'durkster@gmail.com', :_user_type => "UserWithOnlyExtras"}
321
+ expect(user.to_vero).to eq({:email => 'durkster@gmail.com', :_user_type => "UserWithOnlyExtras"})
322
322
  end
323
323
  end
324
324
 
325
325
  describe :with_vero_context do
326
326
  it "should be able to change contexts" do
327
327
  user = User.new
328
- user.with_default_vero_context.config.config_params.should == {:api_key=>"abcd1234", :secret=>"efgh5678"}
329
- user.with_vero_context({:api_key => "boom", :secret => "tish"}).config.config_params.should == {:api_key=>"boom", :secret=>"tish"}
328
+ expect(user.with_default_vero_context.config.config_params).to eq({:api_key=>"abcd1234", :secret=>"efgh5678"})
329
+ expect(user.with_vero_context({:api_key => "boom", :secret => "tish"}).config.config_params).to eq({:api_key=>"boom", :secret=>"tish"})
330
330
  end
331
331
  end
332
332
 
@@ -344,12 +344,12 @@ describe Vero::Trackable do
344
344
 
345
345
  context = Vero::Context.new(Vero::App.default_context)
346
346
  context.subject = user
347
- context.stub(:post_now).and_return(200)
347
+ allow(context).to receive(:post_now).and_return(200)
348
348
 
349
- user.stub(:with_vero_context).and_return(context)
349
+ allow(user).to receive(:with_vero_context).and_return(context)
350
350
 
351
- RestClient.stub(:post).and_return(200)
352
- user.vero_track(request_params[:event_name], request_params[:data]).should == 200
351
+ allow(RestClient).to receive(:post).and_return(200)
352
+ expect(user.vero_track(request_params[:event_name], request_params[:data])).to eq(200)
353
353
  end
354
354
  end
355
355
  end