calendarium-romanum-remote 0.2.0 → 0.3.0

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: a5888b0e5f69d9b5ce0050ffb65e7ce87049d411
4
- data.tar.gz: 7a98baf6c8de7f79988fa9a92ef310f239509ef4
3
+ metadata.gz: e8a229e1d62e64d0d6c3a4e54f996cc9bb741925
4
+ data.tar.gz: 68488c0a34df9a72505d586400f55885139dd6f4
5
5
  SHA512:
6
- metadata.gz: 28ca711f6238c89197d45df0c11f655484570a953eae40c57b72e6f7de0760b607569216cddc076616a9a50014e5daf7e267ab5e5820641a4e2cec270189f42e
7
- data.tar.gz: 3a2fb22ceddb56e7d97f48726865f7892d95198d46285beaa2a411bc974379257f98e8e30cb914e28e40501ed0135489b6f077a6154b9c52f938fcb226eb3c24
6
+ metadata.gz: 3ccdc0dc4297d5976f364109905c1ca851bfd560b33302166659b70fe48f22a50f955af72a77f01250b2df457fcbb03a08b20e5109da309de84f1b87f59f320f
7
+ data.tar.gz: a64c004b8b409717cd3e9e0e747c208aa0c73adc27802e4a4d426efba68f48fd60689200d7927644ff06f7d3ce1e0add919e535a1731feaca6c058e646ac28c3
@@ -0,0 +1,2 @@
1
+ *~
2
+ .rvmrc
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
@@ -0,0 +1,9 @@
1
+ # configuration for https://github.com/thoughtbot/appraisal
2
+
3
+ 4.upto(7) do |i|
4
+ version = "0.#{i}.0"
5
+
6
+ appraise version do
7
+ gem 'calendarium-romanum', version
8
+ end
9
+ end
@@ -0,0 +1,34 @@
1
+ # Changelog
2
+
3
+ ## [0.3.0] 2020-06-28
4
+
5
+ ### Added
6
+
7
+ * `Calendar` methods for API compatibility with calendarium-romanum
8
+ up to 0.7.0
9
+
10
+ ### Changed
11
+
12
+ * calendarium-romanum version requirements loosened
13
+
14
+ ## [0.2.0] 2019-09-22
15
+
16
+ ### Added
17
+
18
+ * strict validation of incoming data
19
+ * distinctive User-Agent request header
20
+
21
+ ### Changed
22
+
23
+ * use `HTTPi` and `multi_json` abstraction layers
24
+ * `CalendariumRomanum::Remote::Calendar` constructor argument
25
+ `api_version` removed, argument `driver` changed semantics
26
+ * concept of a "driver" shifted significantly
27
+ * `ServerNotFoundError`, `BadRequestError` and `TransportError`
28
+ exceptions dropped
29
+ * no attempt is made to translate transport-level exceptions,
30
+ those raised by `HTTPi` are left in place
31
+
32
+ ## [0.1.0] 2017-09-02
33
+
34
+ *First public release*
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :test do
6
+ gem 'simplecov'
7
+ gem 'appraisal'
8
+ end
@@ -0,0 +1,97 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ calendarium-romanum-remote (0.2.0)
5
+ calendarium-romanum (~> 0.4)
6
+ dry-schema (~> 1.3)
7
+ httpi (~> 2.0)
8
+ multi_json (~> 1.13)
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ appraisal (2.3.0)
14
+ bundler
15
+ rake
16
+ thor (>= 0.14.0)
17
+ calendarium-romanum (0.7.0)
18
+ i18n (~> 0.6)
19
+ roman-numerals (~> 0.3)
20
+ thor (~> 0.18)
21
+ concurrent-ruby (1.1.6)
22
+ diff-lcs (1.3)
23
+ docile (1.3.1)
24
+ dry-configurable (0.11.6)
25
+ concurrent-ruby (~> 1.0)
26
+ dry-core (~> 0.4, >= 0.4.7)
27
+ dry-equalizer (~> 0.2)
28
+ dry-container (0.7.2)
29
+ concurrent-ruby (~> 1.0)
30
+ dry-configurable (~> 0.1, >= 0.1.3)
31
+ dry-core (0.4.9)
32
+ concurrent-ruby (~> 1.0)
33
+ dry-equalizer (0.3.0)
34
+ dry-inflector (0.2.0)
35
+ dry-initializer (3.0.3)
36
+ dry-logic (1.0.6)
37
+ concurrent-ruby (~> 1.0)
38
+ dry-core (~> 0.2)
39
+ dry-equalizer (~> 0.2)
40
+ dry-schema (1.5.2)
41
+ concurrent-ruby (~> 1.0)
42
+ dry-configurable (~> 0.8, >= 0.8.3)
43
+ dry-core (~> 0.4)
44
+ dry-equalizer (~> 0.2)
45
+ dry-initializer (~> 3.0)
46
+ dry-logic (~> 1.0)
47
+ dry-types (~> 1.4)
48
+ dry-types (1.4.0)
49
+ concurrent-ruby (~> 1.0)
50
+ dry-container (~> 0.3)
51
+ dry-core (~> 0.4, >= 0.4.4)
52
+ dry-equalizer (~> 0.3)
53
+ dry-inflector (~> 0.1, >= 0.1.2)
54
+ dry-logic (~> 1.0, >= 1.0.2)
55
+ httpi (2.4.4)
56
+ rack
57
+ socksify
58
+ i18n (0.9.5)
59
+ concurrent-ruby (~> 1.0)
60
+ json (2.1.0)
61
+ multi_json (1.14.1)
62
+ rack (2.2.3)
63
+ rake (12.0.0)
64
+ roman-numerals (0.3.0)
65
+ rspec (3.6.0)
66
+ rspec-core (~> 3.6.0)
67
+ rspec-expectations (~> 3.6.0)
68
+ rspec-mocks (~> 3.6.0)
69
+ rspec-core (3.6.0)
70
+ rspec-support (~> 3.6.0)
71
+ rspec-expectations (3.6.0)
72
+ diff-lcs (>= 1.2.0, < 2.0)
73
+ rspec-support (~> 3.6.0)
74
+ rspec-mocks (3.6.0)
75
+ diff-lcs (>= 1.2.0, < 2.0)
76
+ rspec-support (~> 3.6.0)
77
+ rspec-support (3.6.0)
78
+ simplecov (0.16.1)
79
+ docile (~> 1.1)
80
+ json (>= 1.8, < 3)
81
+ simplecov-html (~> 0.10.0)
82
+ simplecov-html (0.10.2)
83
+ socksify (1.7.1)
84
+ thor (0.20.3)
85
+
86
+ PLATFORMS
87
+ ruby
88
+
89
+ DEPENDENCIES
90
+ appraisal
91
+ calendarium-romanum-remote!
92
+ rake (~> 12.0)
93
+ rspec (~> 3.6)
94
+ simplecov
95
+
96
+ BUNDLED WITH
97
+ 1.15.1
@@ -0,0 +1,104 @@
1
+ # calendarium-romanum-remote
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/calendarium-romanum-remote.svg)](https://badge.fury.io/rb/calendarium-romanum-remote)
4
+
5
+ Extends [calendarium-romanum][caro] with a new class
6
+ `CalendariumRomanum::Remote::Calendar`.
7
+ It is (only exception being the constructor) API-compatible
8
+ with `CalendariumRomanum::Calendar`, but obtains the data
9
+ from a [remote calendar API][calapi] instead of computing them.
10
+
11
+ ## What it is good for
12
+
13
+ There are cases when you can't - or don't want to - setup a
14
+ `CalendariumRomanum::Calendar` yourself.
15
+ Maybe you don't have all the necessary data, but there is a calendar
16
+ API instance which has them.
17
+ Maybe you always want to have the most accurate and up-to-date data,
18
+ but you don't want to watch for fixes and updates
19
+ to `calendarium-romanum`, and there is a regularly updated instance
20
+ of calendar API out there.
21
+ In all these cases it is convenient to use `calendarium-romanum-remote`
22
+ instead of building a regular `Calendar` in your application.
23
+
24
+ ## Usage
25
+
26
+ Load by
27
+
28
+ ```
29
+ require 'calendarium-romanum'
30
+ require 'calendarium-romanum/remote'
31
+ ```
32
+
33
+ or by a shortcut
34
+
35
+ ```
36
+ require 'calendarium-romanum-remote'
37
+ ```
38
+
39
+ ```ruby
40
+ CR = CalendariumRomanum
41
+
42
+ # create by specifying a year and remote calendar URI
43
+ calendar = CR::Remote::Calendar.new(2016, 'http://calapi.inadiutorium.cz/api/v0/en/calendars/general-la/')
44
+
45
+ # use the same way as the normal Calendar, get the same return values
46
+ day = calendar.day Date.new(2016, 12, 24)
47
+ ```
48
+
49
+ As most abstractions, also the one of `Remote::Calendar` is
50
+ [leaky][leaky_abstractions]:
51
+ a whole bunch of errors specific to the network communication
52
+ taking place in the background can occur.
53
+
54
+ ```ruby
55
+ CR = CalendariumRomanum
56
+
57
+ calendar = CR::Remote::Calendar.new(2016, 'http://calapi.inadiutorium.cz/api/v0/en/calendars/general-la/')
58
+
59
+ begin
60
+ day = calendar.day Date.new(2016, 12, 24)
61
+ rescue CR::Remote::UnexpectedResponseError
62
+ # the server responded with some "unhappy" HTTP status code
63
+ rescue CR::Remote::InvalidDataError => err
64
+ # data returned by the server were not understood
65
+ rescue HTTPI::Error
66
+ # parent class of lower-level network errors raised by HTTPI -
67
+ # see it's documentation or source for the specific exception
68
+ # classes
69
+ end
70
+ ```
71
+
72
+ ## Important implementation details
73
+
74
+ Under the hood [HTTPi][httpi] is used to issue HTTP requests
75
+ and [multi_json][multi_json] for JSON deserialization.
76
+ Both gems provide uniform public interfaces while allowing
77
+ you to choose among several implementations.
78
+ `calendarium-romanum-remote` deliberately does not make any
79
+ choice concerning the implementations and leaves this up to you.
80
+ There are sensible defaults working out of the box,
81
+ but it's advisable to check both gems' documentation to see
82
+ what options you have and how to make use of them.
83
+
84
+ The following example configures `curb` to be used internally
85
+ as HTTP client and `oj` as JSON deserializer.
86
+
87
+ ```
88
+ require 'curb'
89
+ require 'oj'
90
+ require 'calendarium-romanum-remote'
91
+
92
+ HTTPI.adapter = :curb
93
+ MultiJson.adapter = :oj
94
+ ```
95
+
96
+ ## License
97
+
98
+ freely choose between GNU/LGPL 3 and MIT
99
+
100
+ [caro]: https://github.com/igneus/calendarium-romanum
101
+ [calapi]: https://github.com/igneus/church-calendar-api
102
+ [leaky_abstractions]: https://www.joelonsoftware.com/2002/11/11/the-law-of-leaky-abstractions/
103
+ [httpi]: http://httpirb.com
104
+ [multi_json]: https://github.com/intridea/multi_json
@@ -0,0 +1,2 @@
1
+ require 'rspec/core/rake_task'
2
+ RSpec::Core::RakeTask.new(:spec)
@@ -0,0 +1,25 @@
1
+ require_relative 'lib/calendarium-romanum/remote/version'
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = 'calendarium-romanum-remote'
5
+ s.version = CalendariumRomanum::Remote::VERSION
6
+ s.date = CalendariumRomanum::Remote::RELEASE_DATE.to_s
7
+ s.summary = 'remote calendar extension for calendarium-romanum'
8
+
9
+ s.description = 'obtains calendar data from an API'
10
+
11
+ s.authors = ['Jakub Pavlík']
12
+ s.email = 'jkb.pavlik@gmail.com'
13
+ s.files = `git ls-files -z`.split("\x0").reject do |f|
14
+ f.match(%r{^(test|spec|features)/})
15
+ end
16
+ s.homepage = 'http://github.com/igneus/calendarium-romanum-remote'
17
+ s.licenses = ['LGPL-3.0', 'MIT']
18
+
19
+ s.add_dependency 'calendarium-romanum', '~> 0.4'
20
+ s.add_dependency 'httpi', '~> 2.0'
21
+ s.add_dependency 'multi_json', '~> 1.13'
22
+ s.add_dependency 'dry-schema', '~> 1.3'
23
+ s.add_development_dependency 'rake', '~> 12.0'
24
+ s.add_development_dependency 'rspec', '~> 3.6'
25
+ end
@@ -32,7 +32,15 @@ module CalendariumRomanum
32
32
 
33
33
  def_delegators :@temporale, :range_check, :season
34
34
 
35
- def day(*args)
35
+ def populates_vespers?
36
+ false
37
+ end
38
+
39
+ def day(*args, vespers: false)
40
+ if vespers != false
41
+ throw ArgumentError.new('Vespers data supported, but this implementation currently doesn\'t support computing vespers.')
42
+ end
43
+
36
44
  # TODO code copied from CalendariumRomanum::Calendar -
37
45
  # extract to a separate method
38
46
  if args.size == 2
@@ -48,6 +56,23 @@ module CalendariumRomanum
48
56
  @driver.day date
49
57
  end
50
58
 
59
+ # TODO literally copied from CalendariumRomanum::Calendar
60
+ def [](args)
61
+ if args.is_a?(Range)
62
+ args.map {|date| day(date) }
63
+ else
64
+ day(args)
65
+ end
66
+ end
67
+
68
+ # TODO literally copied from CalendariumRomanum::Calendar
69
+ def each
70
+ return to_enum(__method__) unless block_given?
71
+
72
+ temporale.date_range
73
+ .each {|date| yield(day(date)) }
74
+ end
75
+
51
76
  def lectionary
52
77
  year_spec['lectionary'].to_sym
53
78
  end
@@ -56,10 +81,10 @@ module CalendariumRomanum
56
81
  year_spec['ferial_lectionary'].to_i
57
82
  end
58
83
 
59
- def ==(obj)
60
- self.class == obj.class &&
61
- self.year == obj.year &&
62
- self.calendar_uri == obj.calendar_uri
84
+ def ==(b)
85
+ self.class == b.class &&
86
+ self.year == b.year &&
87
+ self.calendar_uri == b.calendar_uri
63
88
  end
64
89
 
65
90
  private
@@ -2,7 +2,7 @@ require 'date'
2
2
 
3
3
  module CalendariumRomanum
4
4
  module Remote
5
- VERSION = '0.2.0'
6
- RELEASE_DATE = Date.new(2019, 9, 22)
5
+ VERSION = '0.3.0'
6
+ RELEASE_DATE = Date.new(2020, 6, 28)
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calendarium-romanum-remote
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Pavlík
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-22 00:00:00.000000000 Z
11
+ date: 2020-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: calendarium-romanum
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.4.0
19
+ version: '0.4'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.4.0
26
+ version: '0.4'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: httpi
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -100,6 +100,15 @@ executables: []
100
100
  extensions: []
101
101
  extra_rdoc_files: []
102
102
  files:
103
+ - ".gitignore"
104
+ - ".rspec"
105
+ - Appraisals
106
+ - CHANGELOG.md
107
+ - Gemfile
108
+ - Gemfile.lock
109
+ - README.md
110
+ - Rakefile
111
+ - calendarium-romanum-remote.gemspec
103
112
  - lib/calendarium-romanum-remote.rb
104
113
  - lib/calendarium-romanum/remote.rb
105
114
  - lib/calendarium-romanum/remote/calendar.rb
@@ -108,9 +117,6 @@ files:
108
117
  - lib/calendarium-romanum/remote/v0/denormalizer.rb
109
118
  - lib/calendarium-romanum/remote/v0/uri_scheme.rb
110
119
  - lib/calendarium-romanum/remote/version.rb
111
- - spec/calendar_spec.rb
112
- - spec/readme_spec.rb
113
- - spec/spec_helper.rb
114
120
  homepage: http://github.com/igneus/calendarium-romanum-remote
115
121
  licenses:
116
122
  - LGPL-3.0
@@ -1,157 +0,0 @@
1
- require_relative 'spec_helper'
2
-
3
- # integration tests exercizing the whole stack and
4
- # making (a lot of) actual HTTP requests!
5
- describe CalendariumRomanum::Remote::Calendar do
6
- CR = CalendariumRomanum
7
- CRRemote = CalendariumRomanum::Remote
8
-
9
- let(:year) { 2016 }
10
- let(:uri) { REMOTE_CALENDAR_URI }
11
- let(:calendar) { described_class.new year, uri }
12
-
13
- describe '#year' do
14
- it 'returns the year passed to the constructor' do
15
- y = 2200
16
- cal = described_class.new y, uri
17
- expect(cal.year).to eq y
18
- end
19
- end
20
-
21
- describe '#lectionary' do
22
- it { expect(calendar.lectionary).to be :A }
23
- end
24
-
25
- describe '#ferial_lectionary' do
26
- it { expect(calendar.ferial_lectionary).to be 1 }
27
- end
28
-
29
- describe '#==' do
30
- describe 'same year and URI' do
31
- let(:c) { described_class.new year, uri }
32
-
33
- it 'is same' do
34
- expect(c == calendar).to be true
35
- end
36
- end
37
-
38
- describe 'year differs' do
39
- let(:c) { described_class.new year + 1, uri }
40
-
41
- it 'is different' do
42
- expect(c == calendar).to be false
43
- end
44
- end
45
-
46
- describe 'URI differs' do
47
- let(:c) { described_class.new year, 'http://other.uri' }
48
-
49
- it 'is different' do
50
- expect(c == calendar).to be false
51
- end
52
- end
53
- end
54
-
55
- describe 'API-compatibility with Calendar' do
56
- describe 'instance methods' do
57
- let(:year) { 2000 }
58
-
59
- let(:origin) { CR::Calendar.new(year) }
60
- let(:mirror) { CRRemote::Calendar.new(year, uri) }
61
-
62
- CR::Calendar.public_instance_methods.each do |method|
63
- describe method do
64
- it 'is defined by origin' do
65
- expect(origin).to respond_to method
66
- end
67
-
68
- it 'is defined by mirror' do
69
- expect(mirror).to respond_to method
70
- end
71
-
72
- it 'definitions match' do
73
- morig = origin.method method
74
- mmirr = mirror.method method
75
-
76
- expect(mmirr.arity).to eq morig.arity
77
- expect(mmirr.parameters).to eq morig.parameters
78
- end
79
- end
80
- end
81
- end
82
- end
83
-
84
- describe 'returns the same data as Calendar' do
85
- # classical calendar with the same settings as `calendar`
86
- let(:sanctorale) { CR::Data::GENERAL_ROMAN_ENGLISH.load }
87
- let(:local_calendar) { CR::Calendar.new(year, sanctorale) }
88
-
89
- let(:remote_calendar) { calendar }
90
-
91
- days = (CR::Temporale::Dates.first_advent_sunday(2016) ... CR::Temporale::Dates.first_advent_sunday(2017))
92
- days.each do |date|
93
- it date do
94
- c = local_calendar.day date
95
- r = remote_calendar.day date
96
-
97
- expect(r).to eq c
98
- end
99
- end
100
- end
101
-
102
- describe 'errors' do
103
- let(:date) { Date.new year, 1, 1 }
104
-
105
- describe 'server does not exist' do
106
- let(:uri) { 'http://does-not-exist.local/' }
107
-
108
- it 'throws SocketError' do
109
- expect do
110
- calendar.day date
111
- end.to raise_exception ::SocketError
112
- end
113
- end
114
-
115
- describe 'server exists, wrong calendar URI' do
116
- let(:wrong_calendar_uri) { uri + 'another-path-segment/' }
117
- let(:calendar) { described_class.new year, wrong_calendar_uri }
118
-
119
- it 'throws CalendariumRomanum::Remote::UnexpectedResponseError' do
120
- expect do
121
- calendar.day date
122
- end.to raise_exception CRRemote::UnexpectedResponseError, /Unexpected HTTP status 404/
123
- end
124
- end
125
-
126
- describe 'bad request - invalid date' do
127
- # this shouldn't ever happen, but it's the easiest way
128
- # to check how the calendar behaves in bad request scenarios
129
- let(:date) do
130
- d = Date.new
131
- d.stub(:year) { 2000 }
132
- d.stub(:month) { 13 }
133
- d.stub(:day) { 40 }
134
-
135
- d
136
- end
137
-
138
- it 'throws CalendariumRomanum::Remote::UnexpectedResponseError' do
139
- expect do
140
- calendar.day date
141
- end.to raise_exception CRRemote::UnexpectedResponseError, /Unexpected HTTP status 400/
142
- end
143
- end
144
-
145
- describe 'unsupported response content' do
146
- it 'fails' do
147
- # HTTP request will return empty JSON
148
- response = HTTPI::Response.new 200, {}, '{}'
149
- allow(HTTPI).to receive(:get).and_return(response)
150
-
151
- expect do
152
- calendar.day date
153
- end.to raise_exception CRRemote::InvalidDataError, /Invalid data: {:date=>\["is missing"/
154
- end
155
- end
156
- end
157
- end
@@ -1,52 +0,0 @@
1
- require 'spec_helper'
2
-
3
- class MarkdownDocument
4
- def initialize(str)
5
- @str = str
6
- end
7
-
8
- def each_ruby_example
9
- example = nil
10
- line = nil
11
- @str.each_line.with_index(1) do |l, i|
12
- if example.nil?
13
- if example_beginning?(l)
14
- example = ''
15
- line = i + 1
16
- end
17
- elsif example_end?(l)
18
- yield example, line
19
- example = nil
20
- else
21
- example += l
22
- end
23
- end
24
- end
25
-
26
- protected
27
-
28
- def example_beginning?(line)
29
- line =~ /^```ruby/
30
- end
31
-
32
- def example_end?(line)
33
- line =~ /```/
34
- end
35
- end
36
-
37
- %w(README.md).each do |path|
38
- describe path do
39
- readme_path = File.expand_path('../../' + path, __FILE__)
40
- readme = File.read readme_path
41
- doc = MarkdownDocument.new readme
42
-
43
- doc.each_ruby_example do |code, line|
44
- describe "example L#{line}" do
45
- it 'executes without failure' do
46
- cls = Class.new
47
- cls.class_eval(code, readme_path, line)
48
- end
49
- end
50
- end
51
- end
52
- end
@@ -1,110 +0,0 @@
1
- require 'simplecov'
2
- SimpleCov.start
3
-
4
- # This file was generated by the `rspec --init` command. Conventionally, all
5
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
6
- # The generated `.rspec` file contains `--require spec_helper` which will cause
7
- # this file to always be loaded, without a need to explicitly require it in any
8
- # files.
9
- #
10
- # Given that it is always loaded, you are encouraged to keep this file as
11
- # light-weight as possible. Requiring heavyweight dependencies from this file
12
- # will add to the boot time of your test suite on EVERY test run, even for an
13
- # individual file that may not need all of that loaded. Instead, consider making
14
- # a separate helper file that requires the additional dependencies and performs
15
- # the additional setup, and require it from the spec files that actually need
16
- # it.
17
- #
18
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
- RSpec.configure do |config|
20
- # rspec-expectations config goes here. You can use an alternate
21
- # assertion/expectation library such as wrong or the stdlib/minitest
22
- # assertions if you prefer.
23
- config.expect_with :rspec do |expectations|
24
- # This option will default to `true` in RSpec 4. It makes the `description`
25
- # and `failure_message` of custom matchers include text for helper methods
26
- # defined using `chain`, e.g.:
27
- # be_bigger_than(2).and_smaller_than(4).description
28
- # # => "be bigger than 2 and smaller than 4"
29
- # ...rather than:
30
- # # => "be bigger than 2"
31
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
32
- end
33
-
34
- # rspec-mocks config goes here. You can use an alternate test double
35
- # library (such as bogus or mocha) by changing the `mock_with` option here.
36
- config.mock_with :rspec do |mocks|
37
- # Prevents you from mocking or stubbing a method that does not exist on
38
- # a real object. This is generally recommended, and will default to
39
- # `true` in RSpec 4.
40
- mocks.verify_partial_doubles = true
41
- end
42
-
43
- # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
44
- # have no way to turn it off -- the option exists only for backwards
45
- # compatibility in RSpec 3). It causes shared context metadata to be
46
- # inherited by the metadata hash of host groups and examples, rather than
47
- # triggering implicit auto-inclusion in groups with matching metadata.
48
- config.shared_context_metadata_behavior = :apply_to_host_groups
49
-
50
- # The settings below are suggested to provide a good initial experience
51
- # with RSpec, but feel free to customize to your heart's content.
52
- =begin
53
- # This allows you to limit a spec run to individual examples or groups
54
- # you care about by tagging them with `:focus` metadata. When nothing
55
- # is tagged with `:focus`, all examples get run. RSpec also provides
56
- # aliases for `it`, `describe`, and `context` that include `:focus`
57
- # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
58
- config.filter_run_when_matching :focus
59
-
60
- # Allows RSpec to persist some state between runs in order to support
61
- # the `--only-failures` and `--next-failure` CLI options. We recommend
62
- # you configure your source control system to ignore this file.
63
- config.example_status_persistence_file_path = "spec/examples.txt"
64
-
65
- # Limits the available syntax to the non-monkey patched syntax that is
66
- # recommended. For more details, see:
67
- # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
68
- # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
69
- # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
70
- config.disable_monkey_patching!
71
-
72
- # This setting enables warnings. It's recommended, but in some cases may
73
- # be too noisy due to issues in dependencies.
74
- config.warnings = true
75
-
76
- # Many RSpec users commonly either run the entire suite or an individual
77
- # file, and it's useful to allow more verbose output when running an
78
- # individual spec file.
79
- if config.files_to_run.one?
80
- # Use the documentation formatter for detailed output,
81
- # unless a formatter has already been configured
82
- # (e.g. via a command-line flag).
83
- config.default_formatter = "doc"
84
- end
85
-
86
- # Print the 10 slowest examples and example groups at the
87
- # end of the spec run, to help surface which specs are running
88
- # particularly slow.
89
- config.profile_examples = 10
90
-
91
- # Run specs in random order to surface order dependencies. If you find an
92
- # order dependency and want to debug it, you can fix the order by providing
93
- # the seed, which is printed after each run.
94
- # --seed 1234
95
- config.order = :random
96
-
97
- # Seed global randomization in this process using the `--seed` CLI option.
98
- # Setting this allows you to use `--seed` to deterministically reproduce
99
- # test failures related to randomization by passing the same `--seed` value
100
- # as the one that triggered the failure.
101
- Kernel.srand config.seed
102
- =end
103
- end
104
-
105
- require_relative '../lib/calendarium-romanum-remote'
106
-
107
- REMOTE_CALENDAR_URI =
108
- ENV['REMOTE_CALENDAR'] || 'http://calapi.inadiutorium.cz/api/v0/en/calendars/general-en/'
109
-
110
- HTTPI.log = false