ns-yapi 0.5.0 → 0.6.0
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.
- checksums.yaml +5 -5
- data/.rubocop.yml +19 -0
- data/.ruby-version +1 -1
- data/.travis.yml +5 -2
- data/Gemfile +13 -5
- data/Gemfile.lock +95 -44
- data/lib/model/prices_url.rb +7 -5
- data/lib/ns_client.rb +123 -97
- data/ns.gemspec +16 -14
- data/rakefile.rb +3 -1
- data/spec/model/prices_url_spec.rb +23 -23
- data/spec/ns_client_spec.rb +158 -173
- data/spec/nsyapi_spec.rb +17 -22
- data/spec/spec_helper.rb +13 -18
- metadata +9 -8
data/spec/nsyapi_spec.rb
CHANGED
@@ -1,33 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe NSYapi do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
config.username = "some-username"
|
10
|
-
config.password = "some-password"
|
6
|
+
context 'Configuration' do
|
7
|
+
it 'should be configurable with a block' do
|
8
|
+
NSYapi.configure do |config|
|
9
|
+
config.username = 'some-username'
|
10
|
+
config.password = 'some-password'
|
11
11
|
end
|
12
|
-
NSYapi
|
13
|
-
NSYapi
|
12
|
+
expect(NSYapi.configuration.username).to eq('some-username')
|
13
|
+
expect(NSYapi.configuration.password).to eq('some-password')
|
14
14
|
end
|
15
|
-
|
16
15
|
end
|
17
16
|
|
18
|
-
context
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
config.
|
23
|
-
config.password = "some-password"
|
17
|
+
context 'Singleton' do
|
18
|
+
it 'should create a singleton' do
|
19
|
+
NSYapi.configure do |config|
|
20
|
+
config.username = 'some-username'
|
21
|
+
config.password = 'some-password'
|
24
22
|
end
|
25
23
|
|
26
|
-
client = NSYapi
|
27
|
-
client.
|
24
|
+
client = NSYapi.client
|
25
|
+
expect(client).to eq(NSYapi.client)
|
28
26
|
end
|
29
|
-
|
30
27
|
end
|
31
|
-
|
32
|
-
|
33
|
-
end
|
28
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,52 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ns_client'
|
1
4
|
require 'simplecov'
|
2
5
|
SimpleCov.start
|
3
6
|
|
4
7
|
require 'coveralls'
|
5
8
|
Coveralls.wear!
|
6
9
|
|
7
|
-
|
8
|
-
require 'httpclient'
|
10
|
+
require 'pry'
|
9
11
|
|
10
12
|
require 'mocha/api'
|
11
13
|
require 'webmock/rspec'
|
12
14
|
require 'timecop'
|
13
15
|
|
14
16
|
spec_helper = Pathname.new(__FILE__).realpath
|
15
|
-
lib_path
|
16
|
-
|
17
|
+
lib_path = File.expand_path('../../lib', spec_helper)
|
18
|
+
$LOAD_PATH.unshift(lib_path)
|
17
19
|
|
18
20
|
##############################################################
|
19
21
|
# Configure rspec
|
20
22
|
|
21
23
|
RSpec.configure do |config|
|
22
|
-
config.order =
|
24
|
+
config.order = 'random'
|
23
25
|
|
24
26
|
config.after(:each) do
|
25
27
|
Timecop.return # make sure timecop is disabled after each test
|
26
28
|
end
|
27
29
|
|
28
|
-
config.
|
29
|
-
config.filter_run :focus => true
|
30
|
+
config.filter_run focus: true
|
30
31
|
config.run_all_when_everything_filtered = true
|
31
32
|
|
32
|
-
|
33
|
-
p
|
34
|
-
config.filter_run_excluding :integration => true
|
33
|
+
if config.inclusion_filter[:integration]
|
34
|
+
p 'Running integrtion specs ONLY.'
|
35
35
|
else
|
36
|
-
p
|
36
|
+
p 'Integration specs are DISABLED. To run integration specs only, use `rspec --tag integration`'
|
37
|
+
config.filter_run_excluding integration: true
|
37
38
|
end
|
38
|
-
|
39
39
|
end
|
40
40
|
|
41
41
|
# END
|
42
42
|
##############################################################
|
43
|
-
$ROOT = File.expand_path("../", lib_path)
|
44
|
-
|
45
|
-
Dir.glob(File.join(lib_path, '/**/*.rb')).each do |file|
|
46
|
-
require file
|
47
|
-
end
|
48
43
|
|
49
44
|
# helper methods for easier testing
|
50
45
|
def load_fixture(filename)
|
51
|
-
File.read(File.join(
|
46
|
+
File.read(File.join(File.dirname(__FILE__), "/fixtures/#{filename}"))
|
52
47
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ns-yapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Hendriks
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2019-04-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: addressable
|
@@ -27,7 +27,7 @@ dependencies:
|
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: '0'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
|
-
name:
|
30
|
+
name: nokogiri
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - ">="
|
@@ -55,7 +55,7 @@ dependencies:
|
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '0'
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
|
-
name:
|
58
|
+
name: rest-client
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - ">="
|
@@ -70,12 +70,13 @@ dependencies:
|
|
70
70
|
version: '0'
|
71
71
|
description: Yet Another (Ruby) NS API client
|
72
72
|
email:
|
73
|
-
-
|
73
|
+
- info@zilverline.com
|
74
74
|
executables: []
|
75
75
|
extensions: []
|
76
76
|
extra_rdoc_files: []
|
77
77
|
files:
|
78
78
|
- ".gitignore"
|
79
|
+
- ".rubocop.yml"
|
79
80
|
- ".ruby-gemset"
|
80
81
|
- ".ruby-version"
|
81
82
|
- ".travis.yml"
|
@@ -103,7 +104,8 @@ files:
|
|
103
104
|
- spec/nsyapi_spec.rb
|
104
105
|
- spec/spec_helper.rb
|
105
106
|
homepage: https://github.com/zilverline/ns-api
|
106
|
-
licenses:
|
107
|
+
licenses:
|
108
|
+
- MIT
|
107
109
|
metadata: {}
|
108
110
|
post_install_message:
|
109
111
|
rdoc_options: []
|
@@ -120,8 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
122
|
- !ruby/object:Gem::Version
|
121
123
|
version: '0'
|
122
124
|
requirements: []
|
123
|
-
|
124
|
-
rubygems_version: 2.2.2
|
125
|
+
rubygems_version: 3.0.3
|
125
126
|
signing_key:
|
126
127
|
specification_version: 4
|
127
128
|
summary: A Ruby client for the NS (Dutch Railways) API
|