vertebrae 0.2.10 → 0.2.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 33d170118c5e28ae1a2a0a935533a6eb91399f59
4
- data.tar.gz: 143acc85ac9cc3bc3f20d94eef9754b014820858
3
+ metadata.gz: abf8d85f53410dfaef4ad36bd30202818d843ebc
4
+ data.tar.gz: 7d83314db1b94909a999208fc8bf0a5319dd388e
5
5
  SHA512:
6
- metadata.gz: a04607160374094ce65eb834e41b91f2de6fb9ea39789d3503a368edc929ddc8fd5bf6dd50acbb9752207784e44fa0d7080f7cc71763562aab7d8daeadd61677
7
- data.tar.gz: 3109d36f5fd4fa04d2c81b4dfd59f67c6c57d4c4eb2361236eda59d4f31eb9e7d1d2b2502394984cb303f42fe1d3fb465dd1873584b3357026220b6c4add9413
6
+ metadata.gz: 2691bf821b17a9637319b82a7bce356e7383662d2e732e7710fa1a672844273b73129e69f0dd34c11e048bcf23b48af00d6d3af517011c47f9f0345b4c8990d7
7
+ data.tar.gz: 6e6100a90b5c9976fda2eff2725c77744cdb6d6cfb5e3e64a0ada66be66475d856d27c3987b347e6a86782eef5b6edc79c3df5b210c15165e47534c1bd8a389c
data/Gemfile CHANGED
@@ -13,5 +13,7 @@ gem 'hashie'
13
13
  group :development do
14
14
  gem "rspec"
15
15
  gem "bundler"
16
+ gem "webmock"
17
+ gem "rspec-its"
16
18
  gem "jeweler", "~> 2.0.0"
17
19
  end
data/Gemfile.lock CHANGED
@@ -1,33 +1,35 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- activesupport (4.0.0)
5
- i18n (~> 0.6, >= 0.6.4)
6
- minitest (~> 4.2)
7
- multi_json (~> 1.3)
4
+ activesupport (4.1.4)
5
+ i18n (~> 0.6, >= 0.6.9)
6
+ json (~> 1.7, >= 1.7.7)
7
+ minitest (~> 5.1)
8
8
  thread_safe (~> 0.1)
9
- tzinfo (~> 0.3.37)
9
+ tzinfo (~> 1.1)
10
10
  addressable (2.3.6)
11
- atomic (1.1.10)
12
11
  builder (3.2.2)
13
- descendants_tracker (0.0.3)
14
- diff-lcs (1.2.4)
15
- faraday (0.8.9)
16
- multipart-post (~> 1.2.0)
17
- faraday_middleware (0.9.0)
18
- faraday (>= 0.7.4, < 0.9)
12
+ crack (0.4.2)
13
+ safe_yaml (~> 1.0.0)
14
+ descendants_tracker (0.0.4)
15
+ thread_safe (~> 0.3, >= 0.3.1)
16
+ diff-lcs (1.2.5)
17
+ faraday (0.9.0)
18
+ multipart-post (>= 1.2, < 3)
19
+ faraday_middleware (0.9.1)
20
+ faraday (>= 0.7.4, < 0.10)
19
21
  git (1.2.8)
20
- github_api (0.11.3)
22
+ github_api (0.12.0)
21
23
  addressable (~> 2.3)
22
- descendants_tracker (~> 0.0.1)
24
+ descendants_tracker (~> 0.0.4)
23
25
  faraday (~> 0.8, < 0.10)
24
- hashie (>= 1.2)
26
+ hashie (>= 3.2)
25
27
  multi_json (>= 1.7.5, < 2.0)
26
- nokogiri (~> 1.6.0)
28
+ nokogiri (~> 1.6.3)
27
29
  oauth2
28
30
  hashie (3.2.0)
29
31
  highline (1.6.21)
30
- i18n (0.6.4)
32
+ i18n (0.6.11)
31
33
  jeweler (2.0.1)
32
34
  builder
33
35
  bundler (>= 1.0)
@@ -40,10 +42,10 @@ GEM
40
42
  json (1.8.1)
41
43
  jwt (1.0.0)
42
44
  mini_portile (0.6.0)
43
- minitest (4.7.5)
45
+ minitest (5.4.0)
44
46
  multi_json (1.10.1)
45
47
  multi_xml (0.5.5)
46
- multipart-post (1.2.0)
48
+ multipart-post (2.0.0)
47
49
  nokogiri (1.6.3.1)
48
50
  mini_portile (= 0.6.0)
49
51
  oauth2 (1.0.0)
@@ -56,17 +58,24 @@ GEM
56
58
  rake (10.3.2)
57
59
  rdoc (4.1.1)
58
60
  json (~> 1.4)
59
- rspec (2.14.1)
60
- rspec-core (~> 2.14.0)
61
- rspec-expectations (~> 2.14.0)
62
- rspec-mocks (~> 2.14.0)
63
- rspec-core (2.14.2)
64
- rspec-expectations (2.14.0)
61
+ rspec (2.99.0)
62
+ rspec-core (~> 2.99.0)
63
+ rspec-expectations (~> 2.99.0)
64
+ rspec-mocks (~> 2.99.0)
65
+ rspec-core (2.99.1)
66
+ rspec-expectations (2.99.2)
65
67
  diff-lcs (>= 1.1.3, < 2.0)
66
- rspec-mocks (2.14.1)
67
- thread_safe (0.1.0)
68
- atomic
69
- tzinfo (0.3.37)
68
+ rspec-its (1.0.1)
69
+ rspec-core (>= 2.99.0.beta1)
70
+ rspec-expectations (>= 2.99.0.beta1)
71
+ rspec-mocks (2.99.2)
72
+ safe_yaml (1.0.3)
73
+ thread_safe (0.3.4)
74
+ tzinfo (1.2.1)
75
+ thread_safe (~> 0.1)
76
+ webmock (1.18.0)
77
+ addressable (>= 2.3.6)
78
+ crack (>= 0.3.2)
70
79
 
71
80
  PLATFORMS
72
81
  ruby
@@ -79,3 +88,5 @@ DEPENDENCIES
79
88
  hashie
80
89
  jeweler (~> 2.0.0)
81
90
  rspec
91
+ rspec-its
92
+ webmock
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.10
1
+ 0.2.11
data/lib/api.rb CHANGED
@@ -2,11 +2,12 @@ module Vertebrae
2
2
  class API
3
3
  include Request
4
4
 
5
- attr_accessor :connection
5
+ attr_accessor :connection, :initialisation_options
6
6
 
7
7
  # Create new API
8
8
  #
9
9
  def initialize(options={}, &block)
10
+ self.initialisation_options = options
10
11
  options = default_options.merge(options)
11
12
 
12
13
  yield_or_eval(&block) if block_given?
data/lib/request.rb CHANGED
@@ -28,7 +28,7 @@ module Vertebrae
28
28
  if !::Vertebrae::Request::METHODS.include?(method)
29
29
  raise ArgumentError, "unknown http method: #{method}"
30
30
  end
31
- connection.options = default_options.merge(options)
31
+ connection.options = default_options.merge(initialisation_options.merge(options))
32
32
 
33
33
  path = connection.configuration.prefix + '/' + path
34
34
 
data/spec/logger_spec.rb CHANGED
@@ -2,15 +2,15 @@ require 'spec_helper'
2
2
 
3
3
  describe 'logging' do
4
4
  it "should have a logger" do
5
- Dummy.respond_to?(:logger).should be_true
5
+ Dummy.respond_to?(:logger).should be_truthy
6
6
  end
7
7
 
8
8
  it "should be able to log debug methods" do
9
- Dummy.logger.respond_to?(:debug).should be_true
9
+ Dummy.logger.respond_to?(:debug).should be_truthy
10
10
  end
11
11
 
12
12
  it "should be settable" do
13
- Dummy.respond_to?(:logger=).should be_true
13
+ Dummy.respond_to?(:logger=).should be_truthy
14
14
  log = double()
15
15
  Dummy.logger = log
16
16
  Dummy.logger.should == log
data/spec/request_spec.rb CHANGED
@@ -30,4 +30,48 @@ describe Vertebrae::Request do
30
30
  vb.should_receive(:request).with(:delete, path, params, options)
31
31
  vb.delete_request path, params, options
32
32
  end
33
+
34
+ describe 'it should result in an appropriately configured connection object when it comes time to run transactions' do
35
+ before(:each) do
36
+ logger = double
37
+ logger.stub(:debug).and_return(true)
38
+ Vertebrae::Base.stub(:logger).and_return(logger)
39
+ Vertebrae::API.any_instance.stub(:default_options).and_return({host: 'test.com'})
40
+ end
41
+
42
+ context 'with an empty hash' do
43
+ let(:options) { {} }
44
+ it 'should make the request to the default host' do
45
+ stub_request(:get, 'https://test.com/path')
46
+ vb.request(:get, '/path', {}, options)
47
+ end
48
+ end
49
+
50
+ context 'with a different host' do
51
+ let(:options) { {host: 'test2.com'} }
52
+ it 'should make the request to the default host' do
53
+ stub_request(:get, 'https://test2.com/path')
54
+ vb.request(:get, '/path', {}, options)
55
+ end
56
+ end
57
+
58
+ context 'with host specified at client initiation time' do
59
+ let(:options) { {} }
60
+
61
+ let(:vb) { Vertebrae::API.new host: 'test3.com' }
62
+
63
+ it 'should make the request to the default host' do
64
+ stub_request(:get, 'https://test3.com/path')
65
+ vb.request(:get, '/path', {}, options)
66
+ end
67
+
68
+ context 'with a different host' do
69
+ let(:options) { {host: 'test2.com'} }
70
+ it 'should make the request to the default host' do
71
+ stub_request(:get, 'https://test2.com/path')
72
+ vb.request(:get, '/path', {}, options)
73
+ end
74
+ end
75
+ end
76
+ end
33
77
  end
data/spec/spec_helper.rb CHANGED
@@ -4,14 +4,22 @@ require 'rspec'
4
4
  require 'vertebrae'
5
5
  require 'dummy/dummy'
6
6
  require 'dummy/client'
7
+ require 'webmock/rspec'
7
8
 
9
+ require 'rspec/its'
8
10
 
9
11
  # Requires supporting files with custom matchers and macros, etc,
10
12
  # in ./support/ and its subdirectories.
11
13
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
12
14
 
13
15
  RSpec.configure do |config|
14
-
16
+ config.mock_with :rspec do |mocks|
17
+ mocks.syntax = [:should, :expect]
18
+ end
19
+
20
+ config.expect_with :rspec do |c|
21
+ c.syntax = [:should, :expect]
22
+ end
15
23
  end
16
24
 
17
25
 
data/vertebrae.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: vertebrae 0.2.10 ruby lib
5
+ # stub: vertebrae 0.2.11 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "vertebrae"
9
- s.version = "0.2.10"
9
+ s.version = "0.2.11"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
@@ -67,6 +67,8 @@ Gem::Specification.new do |s|
67
67
  s.add_runtime_dependency(%q<hashie>, [">= 0"])
68
68
  s.add_development_dependency(%q<rspec>, [">= 0"])
69
69
  s.add_development_dependency(%q<bundler>, [">= 0"])
70
+ s.add_development_dependency(%q<webmock>, [">= 0"])
71
+ s.add_development_dependency(%q<rspec-its>, [">= 0"])
70
72
  s.add_development_dependency(%q<jeweler>, ["~> 2.0.0"])
71
73
  else
72
74
  s.add_dependency(%q<activesupport>, [">= 0"])
@@ -75,6 +77,8 @@ Gem::Specification.new do |s|
75
77
  s.add_dependency(%q<hashie>, [">= 0"])
76
78
  s.add_dependency(%q<rspec>, [">= 0"])
77
79
  s.add_dependency(%q<bundler>, [">= 0"])
80
+ s.add_dependency(%q<webmock>, [">= 0"])
81
+ s.add_dependency(%q<rspec-its>, [">= 0"])
78
82
  s.add_dependency(%q<jeweler>, ["~> 2.0.0"])
79
83
  end
80
84
  else
@@ -84,6 +88,8 @@ Gem::Specification.new do |s|
84
88
  s.add_dependency(%q<hashie>, [">= 0"])
85
89
  s.add_dependency(%q<rspec>, [">= 0"])
86
90
  s.add_dependency(%q<bundler>, [">= 0"])
91
+ s.add_dependency(%q<webmock>, [">= 0"])
92
+ s.add_dependency(%q<rspec-its>, [">= 0"])
87
93
  s.add_dependency(%q<jeweler>, ["~> 2.0.0"])
88
94
  end
89
95
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vertebrae
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.10
4
+ version: 0.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Woodhull
@@ -94,6 +94,34 @@ dependencies:
94
94
  - - '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: webmock
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec-its
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
97
125
  - !ruby/object:Gem::Dependency
98
126
  name: jeweler
99
127
  requirement: !ruby/object:Gem::Requirement