acfs 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +8 -141
- data/CHANGELOG.md +0 -325
- data/LICENSE +0 -22
- data/README.md +0 -334
- data/acfs.gemspec +0 -37
- data/lib/acfs.rb +0 -49
- data/lib/acfs/adapter/base.rb +0 -26
- data/lib/acfs/adapter/typhoeus.rb +0 -60
- data/lib/acfs/collection.rb +0 -27
- data/lib/acfs/collections/paginatable.rb +0 -75
- data/lib/acfs/configuration.rb +0 -113
- data/lib/acfs/errors.rb +0 -106
- data/lib/acfs/global.rb +0 -99
- data/lib/acfs/location.rb +0 -78
- data/lib/acfs/middleware/base.rb +0 -20
- data/lib/acfs/middleware/json.rb +0 -27
- data/lib/acfs/middleware/logger.rb +0 -23
- data/lib/acfs/middleware/msgpack.rb +0 -30
- data/lib/acfs/middleware/print.rb +0 -21
- data/lib/acfs/middleware/serializer.rb +0 -39
- data/lib/acfs/operation.rb +0 -81
- data/lib/acfs/request.rb +0 -36
- data/lib/acfs/request/callbacks.rb +0 -50
- data/lib/acfs/resource.rb +0 -37
- data/lib/acfs/resource/attributes.rb +0 -268
- data/lib/acfs/resource/attributes/base.rb +0 -28
- data/lib/acfs/resource/attributes/boolean.rb +0 -37
- data/lib/acfs/resource/attributes/date_time.rb +0 -31
- data/lib/acfs/resource/attributes/dict.rb +0 -37
- data/lib/acfs/resource/attributes/float.rb +0 -31
- data/lib/acfs/resource/attributes/integer.rb +0 -27
- data/lib/acfs/resource/attributes/list.rb +0 -34
- data/lib/acfs/resource/attributes/string.rb +0 -24
- data/lib/acfs/resource/attributes/uuid.rb +0 -47
- data/lib/acfs/resource/dirty.rb +0 -35
- data/lib/acfs/resource/initialization.rb +0 -29
- data/lib/acfs/resource/loadable.rb +0 -33
- data/lib/acfs/resource/locatable.rb +0 -128
- data/lib/acfs/resource/operational.rb +0 -22
- data/lib/acfs/resource/persistence.rb +0 -257
- data/lib/acfs/resource/query_methods.rb +0 -264
- data/lib/acfs/resource/service.rb +0 -42
- data/lib/acfs/resource/validation.rb +0 -37
- data/lib/acfs/response.rb +0 -28
- data/lib/acfs/response/formats.rb +0 -25
- data/lib/acfs/response/status.rb +0 -31
- data/lib/acfs/rspec.rb +0 -11
- data/lib/acfs/runner.rb +0 -97
- data/lib/acfs/service.rb +0 -91
- data/lib/acfs/service/middleware.rb +0 -56
- data/lib/acfs/service/middleware/stack.rb +0 -63
- data/lib/acfs/singleton_resource.rb +0 -83
- data/lib/acfs/stub.rb +0 -172
- data/lib/acfs/util.rb +0 -20
- data/lib/acfs/version.rb +0 -14
- data/lib/acfs/yard.rb +0 -5
- data/spec/acfs/adapter/typhoeus_spec.rb +0 -28
- data/spec/acfs/collection_spec.rb +0 -155
- data/spec/acfs/configuration_spec.rb +0 -51
- data/spec/acfs/global_spec.rb +0 -137
- data/spec/acfs/location_spec.rb +0 -23
- data/spec/acfs/middleware/json_spec.rb +0 -63
- data/spec/acfs/middleware/msgpack_spec.rb +0 -60
- data/spec/acfs/operation_spec.rb +0 -10
- data/spec/acfs/request/callbacks_spec.rb +0 -46
- data/spec/acfs/request_spec.rb +0 -77
- data/spec/acfs/resource/attributes/boolean_spec.rb +0 -56
- data/spec/acfs/resource/attributes/date_time_spec.rb +0 -49
- data/spec/acfs/resource/attributes/dict_spec.rb +0 -75
- data/spec/acfs/resource/attributes/float_spec.rb +0 -59
- data/spec/acfs/resource/attributes/integer_spec.rb +0 -34
- data/spec/acfs/resource/attributes/list_spec.rb +0 -58
- data/spec/acfs/resource/attributes/uuid_spec.rb +0 -40
- data/spec/acfs/resource/attributes_spec.rb +0 -179
- data/spec/acfs/resource/dirty_spec.rb +0 -47
- data/spec/acfs/resource/initialization_spec.rb +0 -30
- data/spec/acfs/resource/loadable_spec.rb +0 -20
- data/spec/acfs/resource/locatable_spec.rb +0 -116
- data/spec/acfs/resource/persistance_spec.rb +0 -316
- data/spec/acfs/resource/query_methods_spec.rb +0 -541
- data/spec/acfs/resource/validation_spec.rb +0 -127
- data/spec/acfs/response/formats_spec.rb +0 -50
- data/spec/acfs/response/status_spec.rb +0 -69
- data/spec/acfs/runner_spec.rb +0 -97
- data/spec/acfs/service/middleware_spec.rb +0 -33
- data/spec/acfs/service_spec.rb +0 -46
- data/spec/acfs/singleton_resource_spec.rb +0 -15
- data/spec/acfs/stub_spec.rb +0 -343
- data/spec/acfs_spec.rb +0 -203
- data/spec/fixtures/config.yml +0 -14
- data/spec/spec_helper.rb +0 -41
- data/spec/support/hash.rb +0 -9
- data/spec/support/response.rb +0 -10
- data/spec/support/service.rb +0 -91
- data/spec/support/shared/find_callbacks.rb +0 -48
@@ -1,60 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Acfs::Middleware::MessagePack do
|
4
|
-
let(:data) { [{id: 1, name: 'Anon'}, {id: 2, name: 'John', friends: [1]}] }
|
5
|
-
let(:body) { '' }
|
6
|
-
let(:headers) { {} }
|
7
|
-
let(:request) { Acfs::Request.new 'url', data: data }
|
8
|
-
let(:response) { Acfs::Response.new request, status: 200, headers: headers, body: body }
|
9
|
-
let(:decoder) { Acfs::Middleware::MessagePack.new ->(req) { req } }
|
10
|
-
|
11
|
-
before do
|
12
|
-
decoder.call request
|
13
|
-
end
|
14
|
-
|
15
|
-
describe 'encode' do
|
16
|
-
context 'with not serialized request' do
|
17
|
-
it 'should set Content-Type' do
|
18
|
-
expect(request.headers['Content-Type']).to eq 'application/x-msgpack'
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'should append Accept header' do
|
22
|
-
expect(request.headers['Accept']).to eq 'application/x-msgpack;q=1'
|
23
|
-
end
|
24
|
-
|
25
|
-
context 'with JSON chained' do
|
26
|
-
let(:decoder) { Acfs::Middleware::JSON.new super(), q: 0.5 }
|
27
|
-
|
28
|
-
it 'should append to Accept header' do
|
29
|
-
expect(request.headers['Accept']).to eq 'application/json;q=0.5,application/x-msgpack;q=1'
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'should serialize data to MessagePack' do
|
34
|
-
expect(MessagePack.unpack(request.body)).to eq data.map(&:stringify_keys)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
context 'with Message Pack response' do
|
40
|
-
let(:headers) { {'Content-Type' => 'application/x-msgpack'} }
|
41
|
-
let(:body) { MessagePack.pack data }
|
42
|
-
|
43
|
-
it 'should decode body data' do
|
44
|
-
request.complete! response
|
45
|
-
|
46
|
-
expect(response.data).to be == data.map(&:stringify_keys)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
context 'without Message Pack response' do
|
51
|
-
let(:headers) { {'Content-Type' => 'application/text'} }
|
52
|
-
let(:body) { data.to_json }
|
53
|
-
|
54
|
-
it 'should not decode non-MessagePack encoded responses' do
|
55
|
-
request.complete! response
|
56
|
-
|
57
|
-
expect(response.data).to be_nil
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
data/spec/acfs/operation_spec.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Acfs::Request::Callbacks do
|
4
|
-
let(:callback) { ->(_res) {} }
|
5
|
-
let(:request) { Acfs::Request.new('fubar') }
|
6
|
-
|
7
|
-
describe '#on_complete' do
|
8
|
-
it 'should store a given callback' do
|
9
|
-
request.on_complete(&callback)
|
10
|
-
|
11
|
-
expect(request.callbacks).to have(1).item
|
12
|
-
expect(request.callbacks[0]).to be == callback
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'should store multiple callback' do
|
16
|
-
request.on_complete {|_res| 'abc' }
|
17
|
-
request.on_complete(&callback)
|
18
|
-
|
19
|
-
expect(request.callbacks).to have(2).item
|
20
|
-
expect(request.callbacks[0]).to be == callback
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe '#complete!' do
|
25
|
-
let(:response) { Acfs::Response.new(request) }
|
26
|
-
|
27
|
-
it 'should trigger registered callbacks with given response' do
|
28
|
-
expect(callback).to receive(:call).with(response, kind_of(Proc))
|
29
|
-
|
30
|
-
request.on_complete(&callback)
|
31
|
-
request.complete! response
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'should trigger multiple callback in reverted insertion order' do
|
35
|
-
check = []
|
36
|
-
|
37
|
-
request.on_complete {|res, nxt| check << 1; nxt.call res }
|
38
|
-
request.on_complete {|res, nxt| check << 2; nxt.call res }
|
39
|
-
request.on_complete {|res, nxt| check << 3; nxt.call res }
|
40
|
-
|
41
|
-
request.complete! response
|
42
|
-
|
43
|
-
expect(check).to be == [3, 2, 1]
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
data/spec/acfs/request_spec.rb
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Acfs::Request do
|
4
|
-
let(:url) { 'http://api.example.org/v1/examples' }
|
5
|
-
let(:headers) { nil }
|
6
|
-
let(:params) { nil }
|
7
|
-
let(:data) { nil }
|
8
|
-
let(:method) { :get }
|
9
|
-
let(:options) { {method: method, headers: headers, params: params, data: data} }
|
10
|
-
let(:request) { Acfs::Request.new(url, options) }
|
11
|
-
|
12
|
-
describe '#url' do
|
13
|
-
it 'should return request URL' do
|
14
|
-
expect(request.url).to be == url
|
15
|
-
end
|
16
|
-
|
17
|
-
context 'with parameters' do
|
18
|
-
let(:params) { {id: 10} }
|
19
|
-
|
20
|
-
it 'should return URL without query' do
|
21
|
-
expect(request.url).to be == "#{url}"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe '#headers' do
|
27
|
-
let(:headers) { {'Accept' => 'application/json'} }
|
28
|
-
|
29
|
-
it 'should return request headers' do
|
30
|
-
expect(request.headers).to be == headers
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe '#method' do
|
35
|
-
context 'when nil given' do
|
36
|
-
let(:method) { nil }
|
37
|
-
|
38
|
-
it 'should default to :get' do
|
39
|
-
expect(request.method).to be == :get
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'should return request method' do
|
44
|
-
expect(request.method).to be == method
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
describe '#params' do
|
49
|
-
let(:params) { {id: 10} }
|
50
|
-
|
51
|
-
it 'should return request headers' do
|
52
|
-
expect(request.params).to be == params
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
describe '#data' do
|
57
|
-
let(:data) { {id: 10, name: 'Anon'} }
|
58
|
-
|
59
|
-
it 'should return request data' do
|
60
|
-
expect(request.data).to be == data
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
describe '#data' do
|
65
|
-
context 'with data' do
|
66
|
-
let(:data) { {id: 10, name: 'Anon'} }
|
67
|
-
|
68
|
-
it { expect(request).to be_data }
|
69
|
-
end
|
70
|
-
|
71
|
-
context 'without data' do
|
72
|
-
let(:data) { nil }
|
73
|
-
|
74
|
-
it { expect(request).to_not be_data }
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Acfs::Resource::Attributes::Boolean do
|
4
|
-
subject { Acfs::Resource::Attributes::Boolean.new }
|
5
|
-
|
6
|
-
describe '#cast' do
|
7
|
-
it 'casts nil' do
|
8
|
-
expect(subject.cast(nil)).to eq nil
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'casts empty string to false' do
|
12
|
-
expect(subject.cast('')).to eq nil
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'casts blank string to false' do
|
16
|
-
expect(subject.cast(" \t")).to eq nil
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'preserves boolean values' do
|
20
|
-
expect(subject.cast(false)).to eq false
|
21
|
-
expect(subject.cast(true)).to eq true
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'casts falsy values to false' do
|
25
|
-
expect(subject.cast(false)).to eq false
|
26
|
-
expect(subject.cast(0)).to eq false
|
27
|
-
expect(subject.cast('0')).to eq false
|
28
|
-
expect(subject.cast('no')).to eq false
|
29
|
-
expect(subject.cast('NO')).to eq false
|
30
|
-
expect(subject.cast('off')).to eq false
|
31
|
-
expect(subject.cast('OFF')).to eq false
|
32
|
-
expect(subject.cast('false')).to eq false
|
33
|
-
expect(subject.cast('FALSE')).to eq false
|
34
|
-
expect(subject.cast('f')).to eq false
|
35
|
-
expect(subject.cast('F')).to eq false
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'casts any other value to true' do
|
39
|
-
expect(subject.cast(true)).to eq true
|
40
|
-
expect(subject.cast(1)).to eq true
|
41
|
-
expect(subject.cast('1')).to eq true
|
42
|
-
expect(subject.cast('yes')).to eq true
|
43
|
-
expect(subject.cast('YES')).to eq true
|
44
|
-
expect(subject.cast('on')).to eq true
|
45
|
-
expect(subject.cast('ON')).to eq true
|
46
|
-
expect(subject.cast('true')).to eq true
|
47
|
-
expect(subject.cast('TRUE')).to eq true
|
48
|
-
expect(subject.cast('t')).to eq true
|
49
|
-
expect(subject.cast('T')).to eq true
|
50
|
-
|
51
|
-
expect(subject.cast(2)).to eq true
|
52
|
-
expect(subject.cast('wrong')).to eq true
|
53
|
-
expect(subject.cast('random')).to eq true
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Acfs::Resource::Attributes::DateTime do
|
4
|
-
let(:type) { Acfs::Resource::Attributes::DateTime.new }
|
5
|
-
|
6
|
-
describe '#cast' do
|
7
|
-
subject { -> { type.cast value } }
|
8
|
-
|
9
|
-
context 'with nil' do
|
10
|
-
let(:value) { nil }
|
11
|
-
it { expect(subject.call).to eq nil }
|
12
|
-
end
|
13
|
-
|
14
|
-
context 'with empty string' do
|
15
|
-
let(:value) { '' }
|
16
|
-
it { expect(subject.call).to eq nil }
|
17
|
-
end
|
18
|
-
|
19
|
-
context 'with blank string' do
|
20
|
-
let(:value) { " \t" }
|
21
|
-
it { expect(subject.call).to eq nil }
|
22
|
-
end
|
23
|
-
|
24
|
-
context 'with DateTime' do
|
25
|
-
let(:value) { DateTime.now }
|
26
|
-
it { expect(subject.call).to eq value }
|
27
|
-
end
|
28
|
-
|
29
|
-
context 'with Time' do
|
30
|
-
let(:value) { Time.now }
|
31
|
-
it { expect(subject.call).to eq value.to_datetime }
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'with Date' do
|
35
|
-
let(:value) { Date.today }
|
36
|
-
it { expect(subject.call).to eq value.to_datetime }
|
37
|
-
end
|
38
|
-
|
39
|
-
context 'with ISO8601' do
|
40
|
-
let(:value) { DateTime.now.iso8601 }
|
41
|
-
it { expect(subject.call.iso8601).to eq value }
|
42
|
-
end
|
43
|
-
|
44
|
-
context 'with invalid string' do
|
45
|
-
let(:value) { 'qwe123' }
|
46
|
-
it { is_expected.to raise_error ArgumentError }
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,75 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Acfs::Resource::Attributes::Dict do
|
4
|
-
let(:type) { Acfs::Resource::Attributes::Dict.new }
|
5
|
-
|
6
|
-
describe '#cast' do
|
7
|
-
subject { -> { type.cast value } }
|
8
|
-
|
9
|
-
context 'with nil' do
|
10
|
-
let(:value) { nil }
|
11
|
-
it { expect(subject.call).to eq nil }
|
12
|
-
end
|
13
|
-
|
14
|
-
context 'with blank string (I)' do
|
15
|
-
let(:value) { '' }
|
16
|
-
it { expect(subject.call).to eq Hash.new }
|
17
|
-
end
|
18
|
-
|
19
|
-
context 'with blank string (II)' do
|
20
|
-
let(:value) { " \t" }
|
21
|
-
it { expect(subject.call).to eq Hash.new }
|
22
|
-
end
|
23
|
-
|
24
|
-
context 'with hash' do
|
25
|
-
let(:value) { {3 => true, abc: 4} }
|
26
|
-
it { expect(subject.call).to eq value }
|
27
|
-
end
|
28
|
-
|
29
|
-
context 'with non hashable object' do
|
30
|
-
let(:value) { Object.new }
|
31
|
-
it { is_expected.to raise_error TypeError }
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'with hashable object (I)' do
|
35
|
-
let(:value) do
|
36
|
-
Class.new do
|
37
|
-
def to_hash
|
38
|
-
{id: object_id}
|
39
|
-
end
|
40
|
-
end.new
|
41
|
-
end
|
42
|
-
|
43
|
-
it { expect(subject.call).to eq id: value.object_id }
|
44
|
-
end
|
45
|
-
|
46
|
-
context 'with hashable object (II)' do
|
47
|
-
let(:value) do
|
48
|
-
Class.new do
|
49
|
-
def to_h
|
50
|
-
{id: object_id}
|
51
|
-
end
|
52
|
-
end.new
|
53
|
-
end
|
54
|
-
|
55
|
-
it { expect(subject.call).to eq id: value.object_id }
|
56
|
-
end
|
57
|
-
|
58
|
-
context 'with serializable object' do
|
59
|
-
let(:value) do
|
60
|
-
Class.new do
|
61
|
-
def serializable_hash
|
62
|
-
{id: object_id}
|
63
|
-
end
|
64
|
-
end.new
|
65
|
-
end
|
66
|
-
|
67
|
-
it { expect(subject.call).to eq id: value.object_id }
|
68
|
-
end
|
69
|
-
|
70
|
-
context 'with hash subclass object' do
|
71
|
-
let(:value) { HashWithIndifferentAccess.new test: :foo }
|
72
|
-
it { expect(subject.call).to be value }
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Acfs::Resource::Attributes::Float do
|
4
|
-
let(:type) { Acfs::Resource::Attributes::Float.new }
|
5
|
-
|
6
|
-
describe '#cast' do
|
7
|
-
subject { -> { type.cast value } }
|
8
|
-
|
9
|
-
context 'with nil' do
|
10
|
-
let(:value) { nil }
|
11
|
-
it { expect(subject.call).to eq nil }
|
12
|
-
end
|
13
|
-
|
14
|
-
context 'with blank string (I)' do
|
15
|
-
let(:value) { '' }
|
16
|
-
it { expect(subject.call).to eq 0.0 }
|
17
|
-
end
|
18
|
-
|
19
|
-
context 'with blank string (II)' do
|
20
|
-
let(:value) { " \t" }
|
21
|
-
it { expect(subject.call).to eq 0.0 }
|
22
|
-
end
|
23
|
-
|
24
|
-
context 'with float' do
|
25
|
-
let(:value) { 1.7 }
|
26
|
-
it { expect(subject.call).to eq 1.7 }
|
27
|
-
end
|
28
|
-
|
29
|
-
context 'with Infinity' do
|
30
|
-
let(:value) { 'Infinity' }
|
31
|
-
it { expect(subject.call).to eq ::Float::INFINITY }
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'with -Infinity' do
|
35
|
-
let(:value) { '-Infinity' }
|
36
|
-
it { expect(subject.call).to eq -::Float::INFINITY }
|
37
|
-
end
|
38
|
-
|
39
|
-
context 'with NaN' do
|
40
|
-
let(:value) { 'NaN' }
|
41
|
-
it { expect(subject.call).to be_nan }
|
42
|
-
end
|
43
|
-
|
44
|
-
context 'with fixnum' do
|
45
|
-
let(:value) { 1 }
|
46
|
-
it { expect(subject.call).to eq 1.0 }
|
47
|
-
end
|
48
|
-
|
49
|
-
context 'with valid string' do
|
50
|
-
let(:value) { '1.7' }
|
51
|
-
it { expect(subject.call).to eq 1.7 }
|
52
|
-
end
|
53
|
-
|
54
|
-
context 'with invalid string (I)' do
|
55
|
-
let(:value) { '1.7a' }
|
56
|
-
it { is_expected.to raise_error ArgumentError }
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Acfs::Resource::Attributes::Integer do
|
4
|
-
let(:type) { Acfs::Resource::Attributes::Integer.new }
|
5
|
-
|
6
|
-
describe '#cast' do
|
7
|
-
subject { -> { type.cast value } }
|
8
|
-
|
9
|
-
context 'with nil' do
|
10
|
-
let(:value) { nil }
|
11
|
-
it { expect(subject.call).to eq nil }
|
12
|
-
end
|
13
|
-
|
14
|
-
context 'with empty string' do
|
15
|
-
let(:value) { '' }
|
16
|
-
it { expect(subject.call).to eq 0 }
|
17
|
-
end
|
18
|
-
|
19
|
-
context 'with blank string' do
|
20
|
-
let(:value) { " \t" }
|
21
|
-
it { expect(subject.call).to eq 0 }
|
22
|
-
end
|
23
|
-
|
24
|
-
context 'with string' do
|
25
|
-
let(:value) { '123' }
|
26
|
-
it { expect(subject.call).to eq 123 }
|
27
|
-
end
|
28
|
-
|
29
|
-
context 'with invalid string' do
|
30
|
-
let(:value) { '123a' }
|
31
|
-
it { is_expected.to raise_error ArgumentError }
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|