ferver 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +0,0 @@
1
- module Ferver
2
- DirectoryNotFoundError = Class.new(StandardError)
3
- end
@@ -1,32 +0,0 @@
1
-
2
- module Ferver
3
- class FileIdRequest
4
- attr_reader :value
5
-
6
- def initialize(value = nil)
7
- @is_valid = false
8
-
9
- self.value = value
10
- end
11
-
12
- def value=(value)
13
- @value = parse_value(value)
14
- end
15
-
16
- def valid?
17
- @is_valid
18
- end
19
-
20
- private
21
-
22
- def parse_value(value)
23
- begin
24
- int_val = Integer(value)
25
- @is_valid = true
26
- int_val
27
- rescue
28
- @is_valid = false
29
- end
30
- end
31
- end
32
- end
@@ -1,65 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Ferver::FileIdRequest do
4
- describe 'creating new instance' do
5
- context 'when valid Integer is passed' do
6
- subject { Ferver::FileIdRequest.new(1) }
7
-
8
- it 'should return expected value' do
9
- expect(subject.value).to eq(1)
10
- end
11
- end
12
-
13
- context 'when nil argument is passed' do
14
- it 'should be invalid' do
15
- id_request = Ferver::FileIdRequest.new(nil)
16
-
17
- expect(id_request.valid?).to be_falsey
18
- end
19
- end
20
- end
21
-
22
- describe '#value= method' do
23
- subject { Ferver::FileIdRequest.new }
24
-
25
- context 'when valid Integer is passed' do
26
- before { subject.value = 1 }
27
-
28
- it 'should be valid' do
29
- expect(subject.valid?).to be_truthy
30
- end
31
-
32
- it 'should return expected value' do
33
- expect(subject.value).to eq(1)
34
- end
35
- end
36
-
37
- context 'when valid String as Integer is passed' do
38
- before { subject.value = '1' }
39
-
40
- it 'should be valid' do
41
- expect(subject.valid?).to be_truthy
42
- end
43
-
44
- it 'should return expected value' do
45
- expect(subject.value).to eq(1)
46
- end
47
- end
48
-
49
- context 'when a string is passed' do
50
- before { subject.value = 'foo' }
51
-
52
- it 'should be invalid' do
53
- expect(subject.valid?).to be_falsey
54
- end
55
- end
56
-
57
- context 'when an empty string is passed' do
58
- it 'should be invalid' do
59
- subject.value = ''
60
-
61
- expect(subject.valid?).to be_falsey
62
- end
63
- end
64
- end
65
- end