wakatime 0.0.1 → 0.0.2

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.
@@ -1,67 +1,67 @@
1
- #encoding: UTF-8
1
+ # encoding: UTF-8
2
2
 
3
3
  require 'spec_helper'
4
4
  require 'support/account'
5
5
  require 'wakatime'
6
6
  require 'webmock/rspec'
7
7
 
8
- describe Wakatime, :skip => true do
8
+ describe Wakatime, skip: true do
9
9
  before do
10
10
  WebMock.allow_net_connect!
11
- @session = Wakatime::Session.new({
11
+ @session = Wakatime::Session.new(
12
12
  api_key: ACCOUNT['api_key']
13
- })
13
+ )
14
14
 
15
15
  @client = Wakatime::Client.new(@session)
16
16
 
17
17
  end
18
18
 
19
- it "raises an AuthError if not client auth fails" do
20
- session = Wakatime::Session.new({
19
+ it 'raises an AuthError if not client auth fails' do
20
+ session = Wakatime::Session.new(
21
21
  api_key: 'bad-key'
22
- })
22
+ )
23
23
 
24
24
  @bad_client = Wakatime::Client.new(session)
25
25
 
26
- lambda {@bad_client.summary}.should raise_error( Wakatime::AuthError )
26
+ expect { @bad_client.summary }.to raise_error(Wakatime::AuthError)
27
27
  end
28
28
  describe Wakatime::Client do
29
29
 
30
- it "will return json scoped to specified times" do
30
+ it 'will return json scoped to specified times' do
31
31
  summary = @client.summary
32
- summary.should be_a Wakatime::Models::Summary
33
- summary.should respond_to :grand_total
34
- summary.should respond_to :projects
32
+ expect(summary).to be_a Wakatime::Models::Summary
33
+ expect(summary).to respond_to :grand_total
34
+ expect(summary).to respond_to :projects
35
35
  end
36
36
 
37
- it "will return json scoped to specified times" do
37
+ it 'will return json scoped to specified times' do
38
38
  actions = @client.actions
39
- actions.should be_a Array
40
- actions.first.should be_a Wakatime::Models::Action
41
- actions.first.should respond_to :file
42
- actions.first.should respond_to :time
39
+ expect(actions).to be_a Array
40
+ expect(actions.first).to be_a Wakatime::Models::Action
41
+ expect(actions.first).to respond_to :file
42
+ expect(actions.first).to respond_to :time
43
43
  end
44
44
 
45
- it "will return current user json" do
45
+ it 'will return current user json' do
46
46
  current_user = @client.current_user
47
- current_user.should be_a Wakatime::Models::User
48
- current_user.should respond_to :email
49
- current_user.should respond_to :timezone
47
+ expect(current_user).to be_a Wakatime::Models::User
48
+ expect(current_user).to respond_to :email
49
+ expect(current_user).to respond_to :timezone
50
50
  end
51
51
 
52
- it "will return plugin usage json scoped to specified times" do
52
+ it 'will return plugin usage json scoped to specified times' do
53
53
  plugins = @client.plugins
54
- plugins.should be_a Array
55
- plugins.first.should be_a Wakatime::Models::Plugin
56
- plugins.first.should respond_to :name
54
+ expect(plugins).to be_a Array
55
+ expect(plugins.first).to be_a Wakatime::Models::Plugin
56
+ expect(plugins.first).to respond_to :name
57
57
  end
58
58
 
59
- it "will return daily json scoped to specified times" do
59
+ it 'will return daily json scoped to specified times' do
60
60
  daily = @client.daily
61
- daily.should be_a Array
62
- daily.first.should be_a Wakatime::Models::Summary
63
- daily.first.should respond_to :grand_total
64
- daily.first.should respond_to :projects
61
+ expect(daily).to be_a Array
62
+ expect(daily.first).to be_a Wakatime::Models::Summary
63
+ expect(daily.first).to respond_to :grand_total
64
+ expect(daily.first).to respond_to :projects
65
65
  end
66
66
  end
67
67
  end
@@ -1,4 +1,4 @@
1
- #encoding: UTF-8
1
+ # encoding: UTF-8
2
2
 
3
3
  require 'spec_helper'
4
4
  require 'support/account'
@@ -8,40 +8,40 @@ require 'webmock/rspec'
8
8
  describe Wakatime::Session do
9
9
  before do
10
10
 
11
- @session = Wakatime::Session.new({
12
- api_key: "Lame Key"
13
- })
11
+ @session = Wakatime::Session.new(
12
+ api_key: 'Lame Key'
13
+ )
14
14
 
15
15
  @client = Wakatime::Client.new(@session)
16
16
 
17
17
  end
18
18
 
19
- it "raises a RequestError if a badly formed request detected by the server" do
20
- stub_request(:get, /.*\/summary.*/).to_return(:status => 401, :body => '{\n \"errors\": [\n \"UNAUTHORIZED\"\n ]\n}', :headers => {})
21
- lambda {@client.summary}.should raise_error( Wakatime::AuthError )
19
+ it 'raises a RequestError if a badly formed request detected by the server' do
20
+ stub_request(:get, /.*\/summary.*/).to_return(status: 401, body: '{\n \"errors\": [\n \"UNAUTHORIZED\"\n ]\n}', headers: {})
21
+ expect { @client.summary }.to raise_error(Wakatime::AuthError)
22
22
 
23
23
  # make sure status and body is
24
24
  # set on error object.
25
25
  begin
26
26
  @client.summary
27
- rescue Exception => e
28
- e.body.should == '{\n \"errors\": [\n \"UNAUTHORIZED\"\n ]\n}'
29
- e.status.should == 401
27
+ rescue StandardError => e
28
+ expect(e.body).to eq '{\n \"errors\": [\n \"UNAUTHORIZED\"\n ]\n}'
29
+ expect(e.status).to eq 401
30
30
  end
31
31
  end
32
32
 
33
- it "raises a ServerError if the server raises a 500 error" do
33
+ it 'raises a ServerError if the server raises a 500 error' do
34
34
  stub_request(:get, /.*\/summary.*/)
35
- .to_return(:status => 503, :body => '{"type": "error", "status": 503, "message": "We messed up!"}', :headers => {})
36
- lambda {@client.summary}.should raise_error( Wakatime::ServerError )
35
+ .to_return(status: 503, body: '{"type": "error", "status": 503, "message": "We messed up!"}', headers: {})
36
+ expect { @client.summary }.to raise_error(Wakatime::ServerError)
37
37
 
38
38
  # make sure status and body is
39
39
  # set on error object.
40
40
  begin
41
41
  @client.summary
42
- rescue Exception => e
43
- e.body.should == '{"type": "error", "status": 503, "message": "We messed up!"}' #TODO establish what happens when wakatime returns a 500 or something else.
44
- e.status.should == 503
42
+ rescue StandardError => e
43
+ expect(e.body).to eq '{"type": "error", "status": 503, "message": "We messed up!"}' # TODO establish what happens when wakatime returns a 500 or something else.
44
+ expect(e.status).to eq 503
45
45
  end
46
46
 
47
47
  end
@@ -1,5 +1,4 @@
1
1
  RSpec.configure do |config|
2
- config.treat_symbols_as_metadata_keys_with_true_values = true
3
- config.filter_run_excluding :skip => true
2
+ config.filter_run_excluding skip: true
4
3
  config.order = 'random'
5
4
  end
@@ -3,5 +3,5 @@ require 'yaml'
3
3
  begin
4
4
  ACCOUNT = YAML.load_file(File.dirname(__FILE__) + '/account.yml')
5
5
  rescue
6
- p "create an account.yml file with your credentials to run integration tests."
7
- end
6
+ p 'create an account.yml file with your credentials to run integration tests.'
7
+ end
@@ -4,27 +4,27 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'wakatime/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "wakatime"
7
+ spec.name = 'wakatime'
8
8
  spec.version = Wakatime::VERSION
9
- spec.authors = ["Russell Osborne"]
10
- spec.email = ["russell@burningpony.com"]
11
- spec.summary = %q{An unofficial ruby gem for accessing Wakatime records}
12
- spec.description = %q{An unofficial ruby gem for accessing Wakatime records}
13
- spec.homepage = ""
14
- spec.license = "MIT"
9
+ spec.authors = ['Russell Osborne']
10
+ spec.email = ['russell@burningpony.com']
11
+ spec.summary = 'An unofficial ruby gem for accessing Wakatime records'
12
+ spec.description = 'An unofficial ruby gem for accessing Wakatime records'
13
+ spec.homepage = ''
14
+ spec.license = 'MIT'
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
19
+ spec.require_paths = ['lib']
20
20
 
21
- spec.add_runtime_dependency(%q<hashie>, [">= 0"])
22
- spec.add_runtime_dependency(%q<activesupport>, [">= 0"])
23
- spec.add_runtime_dependency(%q<multipart-post>, [">= 0"])
24
- spec.add_runtime_dependency(%q<json>, [">= 0"])
25
- spec.add_runtime_dependency(%q<addressable>, [">= 0"])
26
- spec.add_development_dependency(%q<rspec>, [">= 0"])
27
- spec.add_development_dependency(%q<bundler>, [">= 0"])
28
- spec.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
29
- spec.add_development_dependency(%q<webmock>, [">= 0"])
21
+ spec.add_runtime_dependency('hashie', ['>= 0'])
22
+ spec.add_runtime_dependency('activesupport', ['>= 0'])
23
+ spec.add_runtime_dependency('multipart-post', ['>= 0'])
24
+ spec.add_runtime_dependency('json', ['>= 0'])
25
+ spec.add_runtime_dependency('addressable', ['>= 0'])
26
+ spec.add_development_dependency('rspec', ['>= 0'])
27
+ spec.add_development_dependency('bundler', ['>= 0'])
28
+ spec.add_development_dependency('jeweler', ['~> 1.6.4'])
29
+ spec.add_development_dependency('webmock', ['>= 0'])
30
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wakatime
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Russell Osborne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-16 00:00:00.000000000 Z
11
+ date: 2015-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -157,6 +157,7 @@ files:
157
157
  - lib/wakatime/session.rb
158
158
  - lib/wakatime/version.rb
159
159
  - spec/client_spec.rb
160
+ - spec/fixtures/actions.json
160
161
  - spec/fixtures/current_user.json
161
162
  - spec/fixtures/daily.json
162
163
  - spec/fixtures/plugins.json
@@ -187,12 +188,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
188
  version: '0'
188
189
  requirements: []
189
190
  rubyforge_project:
190
- rubygems_version: 2.2.2
191
+ rubygems_version: 2.4.5
191
192
  signing_key:
192
193
  specification_version: 4
193
194
  summary: An unofficial ruby gem for accessing Wakatime records
194
195
  test_files:
195
196
  - spec/client_spec.rb
197
+ - spec/fixtures/actions.json
196
198
  - spec/fixtures/current_user.json
197
199
  - spec/fixtures/daily.json
198
200
  - spec/fixtures/plugins.json