spec/lift_spec.rb in liftapp-client-0.0.5 vs spec/lift_spec.rb in liftapp-client-0.0.6
- old
+ new
@@ -1,47 +1,36 @@
require 'webmock/rspec'
+require 'spec_helper'
require_relative '../lib/liftapp-client.rb'
describe Liftapp::Client do
it 'returns profile_hash' do
- stub_request(:get, "https://neo@matrix.com:whiterabbit@www.lift.do/i/0/users/current").
- to_return(File.new(File.expand_path File.dirname(__FILE__) + '/fixtures/current'))
-
- client = Liftapp::Client.new('neo@matrix.com', 'whiterabbit')
+ client = Liftapp::Client.new('peterpan@neverland.com', 'neverland')
expect(client.profile_hash).to eq 'e7fcd2db926273e895ef'
end
it 'returns habit list' do
- stub_request(:get, "https://neo@matrix.com:whiterabbit@www.lift.do/i/0/users/current").
- to_return(File.new(File.expand_path File.dirname(__FILE__) + '/fixtures/current'))
- stub_request(:get, "https://neo@matrix.com:whiterabbit@www.lift.do/api/v2/dashboard").
- to_return(File.new(File.expand_path File.dirname(__FILE__) + '/fixtures/dashboard'))
-
- client = Liftapp::Client.new('neo@matrix.com', 'whiterabbit')
- expect(client.dashboard['subscriptions'].length).to eq 7
+ client = Liftapp::Client.new('peterpan@neverland.com', 'neverland')
+ expect(client.dashboard['subscriptions'].length).to eq 3
end
it 'returns checkin data' do
- stub_request(:get, "https://neo@matrix.com:whiterabbit@www.lift.do/i/0/users/current").
- to_return(File.new(File.expand_path File.dirname(__FILE__) + '/fixtures/current'))
- stub_request(:get, "https://www.lift.do/users/e7fcd2db926273e895ef/3280").
- to_return(File.new(File.expand_path File.dirname(__FILE__) + '/fixtures/3280'))
-
- client = Liftapp::Client.new('neo@matrix.com', 'whiterabbit')
- data = client.checkin_data('3280')
- data['checkins'].length.should be > 10
- data['habit-name'].should eq 'Write'
+ client = Liftapp::Client.new('peterpan@neverland.com', 'neverland')
+ data = client.checkin_data('2925')
+ expect(data['checkins'].length).to eq 2
+ expect(data['habit-name']).to eq 'Cook'
end
it 'returns successful checkin' do
- stub_request(:get, "https://neo@matrix.com:whiterabbit@www.lift.do/i/0/users/current").
- to_return(File.new(File.expand_path File.dirname(__FILE__) + '/fixtures/current'))
- stub_request(:post, 'https://neo@matrix.com:whiterabbit@www.lift.do/api/v1/checkins').
- to_return(File.new(File.expand_path File.dirname(__FILE__) + '/fixtures/checkin'))
+ client = Liftapp::Client.new('peterpan@neverland.com', 'neverland')
+ data = client.checkin('23946', nil)
+ expect(data['checkin']['id']).to be > 0
+ end
- client = Liftapp::Client.new('neo@matrix.com', 'whiterabbit')
- data = client.checkin('2111')
- data['checkin']['id'].should be > 0
+ it 'sets name and picture_url' do
+ client = Liftapp::Client.new('peterpan@neverland.com', 'neverland')
+ expect(client.picture_url).to eq 'http://profile.ak.fbcdn.net/hprofile-ak-snc6/260854_100003561549613_94631864_q.jpg'
+ expect(client.name).to eq 'Peter Pan'
end
end