gh 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,5 +12,6 @@ rvm:
12
12
  - ree
13
13
  matrix:
14
14
  allow_failures:
15
+ - rvm: jruby-18mode
15
16
  - rvm: jruby-19mode
16
17
  - rvm: jruby-head
data/Rakefile CHANGED
@@ -2,5 +2,5 @@ require 'bundler/gem_tasks'
2
2
  require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new :default do |t|
5
- t.rspec_opts = %w[-bcfd --fail-fast]
5
+ t.rspec_opts = ["-bcfd"]
6
6
  end
data/lib/gh.rb CHANGED
@@ -22,10 +22,11 @@ module GH
22
22
 
23
23
  def self.with(backend)
24
24
  backend = DefaultStack.build(backend) if Hash === backend
25
+ return backend unless block_given?
25
26
  was, self.current = current, backend
26
27
  yield
27
28
  ensure
28
- self.current = was
29
+ self.current = was if was
29
30
  end
30
31
 
31
32
  def self.current
@@ -1,4 +1,4 @@
1
1
  module GH
2
2
  # Public: Library version.
3
- VERSION = "0.5.1"
3
+ VERSION = "0.6.0"
4
4
  end
@@ -11,4 +11,14 @@ describe GH do
11
11
  response = GH.post "somewhere", "foo" => "bar"
12
12
  response['hi'].should be == 'ho'
13
13
  end
14
+
15
+ describe 'with' do
16
+ it 'returns the GH instance if no block is given' do
17
+ GH.with(:token => "...").should be_a(GH::Wrapper)
18
+ end
19
+
20
+ it 'returns the block value if block is given' do
21
+ GH.with(:token => "...") { 42 }.should be == 42
22
+ end
23
+ end
14
24
  end
@@ -19,6 +19,7 @@ describe GH::Parallel do
19
19
  end
20
20
 
21
21
  it 'runs requests in parallel' do
22
+ WebMock.allow_net_connect!
22
23
  GH::DefaultStack.replace GH::MockBackend, GH::Remote
23
24
  GH.current = nil
24
25
  GH.should_not be_in_parallel
@@ -3,6 +3,8 @@ require 'webmock/rspec'
3
3
  require 'yaml'
4
4
  require 'fileutils'
5
5
 
6
+ RUBY_ENGINE = 'ruby' unless defined? RUBY_ENGINE
7
+
6
8
  module GH
7
9
  module TestHelpers
8
10
  def backend(layer = subject)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-25 00:00:00.000000000 Z
12
+ date: 2012-06-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70251530412660 !ruby/object:Gem::Requirement
16
+ requirement: &70302474334740 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70251530412660
24
+ version_requirements: *70302474334740
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: webmock
27
- requirement: &70251530412200 !ruby/object:Gem::Requirement
27
+ requirement: &70302474334320 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70251530412200
35
+ version_requirements: *70302474334320
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: faraday
38
- requirement: &70251530411620 !ruby/object:Gem::Requirement
38
+ requirement: &70302474333820 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0.8'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70251530411620
46
+ version_requirements: *70302474333820
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: backports
49
- requirement: &70251530410820 !ruby/object:Gem::Requirement
49
+ requirement: &70302474333320 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '2.3'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70251530410820
57
+ version_requirements: *70302474333320
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: multi_json
60
- requirement: &70251530410120 !ruby/object:Gem::Requirement
60
+ requirement: &70302474332860 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '1.0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70251530410120
68
+ version_requirements: *70302474332860
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: addressable
71
- requirement: &70251530409280 !ruby/object:Gem::Requirement
71
+ requirement: &70302474332480 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70251530409280
79
+ version_requirements: *70302474332480
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: net-http-persistent
82
- requirement: &70251530430800 !ruby/object:Gem::Requirement
82
+ requirement: &70302474332020 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *70251530430800
90
+ version_requirements: *70302474332020
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: net-http-pipeline
93
- requirement: &70251530428340 !ruby/object:Gem::Requirement
93
+ requirement: &70302474331600 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: '0'
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *70251530428340
101
+ version_requirements: *70302474331600
102
102
  description: multi-layer client for the github api v3
103
103
  email:
104
104
  - konstantin.mailinglists@googlemail.com