patentscope 0.0.2 → 0.0.4
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 +4 -4
- data/.gitignore +1 -1
- data/.ruby-version +1 -1
- data/Gemfile +2 -0
- data/License.txt +1 -1
- data/README.md +2 -2
- data/lib/patentscope.rb +1 -0
- data/lib/patentscope/client.rb +11 -5
- data/lib/patentscope/version.rb +1 -1
- data/lib/patentscope/webservice.rb +7 -3
- data/lib/patentscope/webservice_soap_builder.rb +0 -22
- data/lib/patentscope/webservice_soap_stripper.rb +34 -0
- data/patentscope.gemspec +24 -20
- metadata +24 -44
- data/spec/client_spec.rb +0 -75
- data/spec/configuration_spec.rb +0 -226
- data/spec/patentscope_spec.rb +0 -91
- data/spec/pct_app_number_spec.rb +0 -256
- data/spec/pct_pub_number_spec.rb +0 -220
- data/spec/spec_helper.rb +0 -31
- data/spec/webservice_soap_builder_spec.rb +0 -318
- data/spec/webservice_spec.rb +0 -97
- data/spec/wipo_test_suite_doc_id_examples.yaml +0 -298
- data/spec/wipo_test_suite_ia_number_examples.yaml +0 -40
- data/spec/wipo_test_suite_spec.rb +0 -44
data/spec/configuration_spec.rb
DELETED
@@ -1,226 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Patentscope
|
4
|
-
|
5
|
-
describe Configuration, :core do
|
6
|
-
|
7
|
-
describe 'instance methods' do
|
8
|
-
|
9
|
-
it 'has a username instance method' do
|
10
|
-
expect(Configuration.new).to respond_to(:username)
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'has a password instance method' do
|
14
|
-
expect(Configuration.new).to respond_to(:password)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe 'initialize' do
|
19
|
-
|
20
|
-
let(:configuration) { Configuration.new }
|
21
|
-
|
22
|
-
describe 'default values' do
|
23
|
-
|
24
|
-
it 'username is blank' do
|
25
|
-
expect(configuration.username).to eq('')
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'password is blank' do
|
29
|
-
expect(configuration.password).to eq('')
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe Patentscope, :core, :vcr do
|
36
|
-
|
37
|
-
before(:each) do
|
38
|
-
Patentscope.reset_configuration
|
39
|
-
end
|
40
|
-
|
41
|
-
after(:each) do
|
42
|
-
Patentscope.reset_configuration
|
43
|
-
end
|
44
|
-
|
45
|
-
describe 'class methods' do
|
46
|
-
|
47
|
-
it 'has configure class method' do
|
48
|
-
expect(Patentscope).to respond_to(:configure)
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'has configure_from_env class method' do
|
52
|
-
expect(Patentscope).to respond_to(:configure_from_env)
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'has configured? class method' do
|
56
|
-
expect(Patentscope).to respond_to(:configured?)
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'has reset_configuration class method' do
|
60
|
-
expect(Patentscope).to respond_to(:reset_configuration)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'has an class level accessor to the configuration instance' do
|
65
|
-
expect(Patentscope).to respond_to(:configuration)
|
66
|
-
end
|
67
|
-
|
68
|
-
describe 'unconfigured' do
|
69
|
-
|
70
|
-
describe 'configuration state' do
|
71
|
-
|
72
|
-
it 'is not configured' do
|
73
|
-
expect(Patentscope.configured?).to be false
|
74
|
-
end
|
75
|
-
|
76
|
-
it 'configuration object is nil' do
|
77
|
-
expect(Patentscope.configuration).to be_nil
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
describe 'behaviours when called' do
|
82
|
-
|
83
|
-
it 'raises an error when trying to access username' do
|
84
|
-
expect do
|
85
|
-
Patentscope.configuration.username
|
86
|
-
end.to raise_error(NoMethodError)
|
87
|
-
end
|
88
|
-
|
89
|
-
it 'raises an error when trying to access password' do
|
90
|
-
expect do
|
91
|
-
Patentscope.configuration.password
|
92
|
-
end.to raise_error(NoMethodError)
|
93
|
-
end
|
94
|
-
|
95
|
-
it 'raises an error during client operations' do
|
96
|
-
expect do
|
97
|
-
Webservice.new.get_iasr(ia_number: 'SG2009000062')
|
98
|
-
end.to raise_error(Patentscope::NoCredentialsError)
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
describe 'Patentscope.configure' do
|
104
|
-
|
105
|
-
context 'Patentscope.configure called but no credentials given in block' do
|
106
|
-
|
107
|
-
before { Patentscope.configure }
|
108
|
-
|
109
|
-
describe 'configuration state' do
|
110
|
-
|
111
|
-
it 'is configured' do
|
112
|
-
expect(Patentscope.configured?).to be true
|
113
|
-
end
|
114
|
-
|
115
|
-
it 'configuration object exists' do
|
116
|
-
expect(Patentscope.configuration).to_not be_nil
|
117
|
-
end
|
118
|
-
|
119
|
-
it 'username defaults to null string if not explicitly set in the configure block' do
|
120
|
-
expect(Patentscope.configuration.username).to eq('')
|
121
|
-
end
|
122
|
-
|
123
|
-
it 'password defaults to null string if not explicitly set in the configure block' do
|
124
|
-
expect(Patentscope.configuration.password).to eq('')
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
describe 'behaviours when called' do
|
129
|
-
|
130
|
-
it 'does not raise an error when trying to access username' do
|
131
|
-
expect do
|
132
|
-
Patentscope.configuration.username
|
133
|
-
end.to_not raise_error
|
134
|
-
end
|
135
|
-
|
136
|
-
it 'does not raise an error when trying to access password' do
|
137
|
-
expect do
|
138
|
-
Patentscope.configuration.password
|
139
|
-
end.to_not raise_error
|
140
|
-
end
|
141
|
-
|
142
|
-
it 'raises an error during client operations' do
|
143
|
-
expect do
|
144
|
-
Webservice.new.get_iasr(ia_number: 'SG2009000062')
|
145
|
-
end.to raise_error(Patentscope::WrongCredentialsError)
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
context 'Patentscope.configure called with credentials set in block' do
|
151
|
-
|
152
|
-
before(:each) do
|
153
|
-
Patentscope.configure do |config|
|
154
|
-
config.username = 'joe_bloggs'
|
155
|
-
config.password = 'b10ggsy'
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
it 'configures the username' do
|
160
|
-
expect(Patentscope.configuration.username).to eq('joe_bloggs')
|
161
|
-
end
|
162
|
-
|
163
|
-
it 'configures the password' do
|
164
|
-
expect(Patentscope.configuration.password).to eq('b10ggsy')
|
165
|
-
end
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
describe 'Patentscope.configure_from_env"'do
|
170
|
-
|
171
|
-
context 'with no existing configuration' do
|
172
|
-
|
173
|
-
it 'loading operation succeeds' do
|
174
|
-
expect(Patentscope.configure_from_env).to be true
|
175
|
-
end
|
176
|
-
|
177
|
-
describe 'loads configurations from environment variables' do
|
178
|
-
|
179
|
-
before do
|
180
|
-
ENV['PATENTSCOPE_WEBSERVICE_USERNAME'] = 'joe_bloggs'
|
181
|
-
ENV['PATENTSCOPE_WEBSERVICE_PASSWORD'] = 'b10ggsy'
|
182
|
-
Patentscope.configure_from_env
|
183
|
-
end
|
184
|
-
|
185
|
-
it 'loads the username' do
|
186
|
-
expect(Patentscope.configuration.username).to eq('joe_bloggs')
|
187
|
-
end
|
188
|
-
|
189
|
-
it 'loads the password' do
|
190
|
-
expect(Patentscope.configuration.password).to eq('b10ggsy')
|
191
|
-
end
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
context 'with an existing configuration already loaded' do
|
196
|
-
|
197
|
-
before do
|
198
|
-
ENV['PATENTSCOPE_WEBSERVICE_USERNAME'] = 'foo'
|
199
|
-
ENV['PATENTSCOPE_WEBSERVICE_PASSWORD'] = 'bar'
|
200
|
-
Patentscope.configure_from_env
|
201
|
-
end
|
202
|
-
|
203
|
-
it 'loading operation fails' do
|
204
|
-
expect(Patentscope.configure_from_env).to be false
|
205
|
-
end
|
206
|
-
|
207
|
-
describe 'does not load configurations from environment variables' do
|
208
|
-
|
209
|
-
before do
|
210
|
-
ENV['PATENTSCOPE_WEBSERVICE_USERNAME'] = 'joe_bloggs'
|
211
|
-
ENV['PATENTSCOPE_WEBSERVICE_PASSWORD'] = 'b10ggsy'
|
212
|
-
Patentscope.configure_from_env
|
213
|
-
end
|
214
|
-
|
215
|
-
it 'keeps the already configured username' do
|
216
|
-
expect(Patentscope.configuration.username).to eq('foo')
|
217
|
-
end
|
218
|
-
|
219
|
-
it 'keeps the already configured password' do
|
220
|
-
expect(Patentscope.configuration.password).to eq('bar')
|
221
|
-
end
|
222
|
-
end
|
223
|
-
end
|
224
|
-
end
|
225
|
-
end
|
226
|
-
end
|
data/spec/patentscope_spec.rb
DELETED
@@ -1,91 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Patentscope
|
4
|
-
|
5
|
-
describe Patentscope, :core, :vcr do
|
6
|
-
|
7
|
-
before { Patentscope.configure_from_env }
|
8
|
-
|
9
|
-
let(:patentscope) { Patentscope }
|
10
|
-
|
11
|
-
it "exists" do
|
12
|
-
expect(patentscope).to_not be_nil
|
13
|
-
end
|
14
|
-
|
15
|
-
it "has the right methods" do
|
16
|
-
expect(patentscope).to respond_to(:wsdl)
|
17
|
-
expect(patentscope).to respond_to(:get_available_documents)
|
18
|
-
expect(patentscope).to respond_to(:get_document_content)
|
19
|
-
expect(patentscope).to respond_to(:get_document_ocr_content)
|
20
|
-
expect(patentscope).to respond_to(:get_iasr)
|
21
|
-
expect(patentscope).to respond_to(:get_document_table_of_contents)
|
22
|
-
expect(patentscope).to respond_to(:get_document_content_page)
|
23
|
-
end
|
24
|
-
|
25
|
-
describe "wsdl method" do
|
26
|
-
it "returns a wsdl document" do
|
27
|
-
response = patentscope.wsdl
|
28
|
-
expect(response).to include('<?xml')
|
29
|
-
expect(response).to include('<wsdl:definitions')
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe "get_available_documents method" do
|
34
|
-
it 'returns an appropriate XML document for the get_available_documents operation' do
|
35
|
-
response = patentscope.get_available_documents('SG2009000062')
|
36
|
-
expect(response).to include('<?xml version="1.0"?>')
|
37
|
-
expect(response).to include('<doc ocrPresence="yes" gazette="35/2009" docType="PAMPH" docId="id00000008693323"/>')
|
38
|
-
expect(response).to_not include('<getAvailableDocumentsResponse xmlns="http://www.wipo.org/wsdl/ps">')
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe "get_document_content method" do
|
43
|
-
it 'returns an appropriate XML document for the get_document_content operation' do
|
44
|
-
response = patentscope.get_document_content('090063618004ca88')
|
45
|
-
expect(response).to include('<?xml version="1.0"?>')
|
46
|
-
expect(response).to include('<documentContent>')
|
47
|
-
expect(response).to include('nRpZsy7ezxU2/8/fk5JM6HIXReMWymXUCmhYcRgUIjjNk2pDAkdlxox7xiSLm')
|
48
|
-
expect(response).to_not include('<getDocumentContentResponse xmlns="http://www.wipo.org/wsdl/ps">')
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
describe "get_document_ocr_content method" do
|
53
|
-
it 'returns an appropriate XML document for the get_document_ocr_content operation' do
|
54
|
-
response = patentscope.get_document_ocr_content('id00000015801579')
|
55
|
-
expect(response).to include('<?xml version="1.0"?>')
|
56
|
-
expect(response).to include('<documentContent>')
|
57
|
-
expect(response).to include('XdDb9Ain4kev61wgZc36X022QPCEZZASS2Rwpcy4Hx7I5GYHhriRwpsDwoX9tgjgZwcEGGEksgthsHsNtkFmyGZYQIGGCCX3dhggRDTgEEDNgVgkvuw2ECDDSYMEF')
|
58
|
-
expect(response).to_not include('<getDocumentOcrContentResponse xmlns="http://www.wipo.org/wsdl/ps">')
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
describe "get_iasr method" do
|
63
|
-
it 'returns an appropriate XML document for the get_iasr operation' do
|
64
|
-
response = patentscope.get_iasr('SG2009000062')
|
65
|
-
expect(response).to include('<?xml version="1.0"?>')
|
66
|
-
expect(response).to include('<wo-international-application-status>')
|
67
|
-
expect(response).to include('MESENCHYMAL STEM CELL PARTICLES')
|
68
|
-
expect(response).to_not include('<getIASRResponse xmlns="http://www.wipo.org/wsdl/ps">')
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
describe "get_document_table_of_contents method" do
|
73
|
-
it 'returns an appropriate XML document for the get_document_table_of_contents operation' do
|
74
|
-
response = patentscope.get_document_table_of_contents('090063618004ca88')
|
75
|
-
expect(response).to include('<?xml version="1.0"?>')
|
76
|
-
expect(response).to include('<content>')
|
77
|
-
expect(response).to include('<content>000001.tif</content>')
|
78
|
-
expect(response).to_not include('<getDocumentTableOfContentsResponse xmlns="http://www.wipo.org/wsdl/ps">')
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
describe "get_document_content_page method" do
|
83
|
-
it 'returns an appropriate XML document for the get_document_content_page operation' do
|
84
|
-
response = patentscope.get_document_content_page('090063618004ca88', '000001.tif')
|
85
|
-
expect(response).to include('<?xml version="1.0"?>')
|
86
|
-
expect(response).to include('+GP0kv9dhgiY7Rb5h2q4RN6Jj9NpDCJjuMImO0l0TfLe7QRO2yFceTvvTu6C6qTH')
|
87
|
-
expect(response).to_not include('<getDocumentContentPageResponse xmlns="http://www.wipo.org/wsdl/ps">')
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
data/spec/pct_app_number_spec.rb
DELETED
@@ -1,256 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Patentscope
|
4
|
-
|
5
|
-
describe PctAppNumber, :core do
|
6
|
-
|
7
|
-
let(:pct_app_number) { PctAppNumber.new }
|
8
|
-
|
9
|
-
describe "methods" do
|
10
|
-
it "has the right methods" do
|
11
|
-
expect(pct_app_number).to respond_to(:valid?)
|
12
|
-
expect(pct_app_number).to respond_to(:validate)
|
13
|
-
expect(pct_app_number).to respond_to(:to_ia_number)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
describe "valid? validate methods" do
|
18
|
-
|
19
|
-
describe "application numbers in acceptable format" do
|
20
|
-
|
21
|
-
describe "country, year and number run on" do
|
22
|
-
let(:pct_app_number) { PctAppNumber.new('SG2012000001') }
|
23
|
-
|
24
|
-
it "is valid" do
|
25
|
-
expect(pct_app_number).to be_valid
|
26
|
-
end
|
27
|
-
|
28
|
-
it "validates" do
|
29
|
-
expect { pct_app_number.validate }.to_not raise_error
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe "year and number run on separated by a slash" do
|
34
|
-
let(:pct_app_number) { PctAppNumber.new('SG2012/000001') }
|
35
|
-
|
36
|
-
it "is valid" do
|
37
|
-
expect(pct_app_number).to be_valid
|
38
|
-
end
|
39
|
-
|
40
|
-
it "validates" do
|
41
|
-
expect { pct_app_number.validate }.to_not raise_error
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
describe "leading space before application number" do
|
46
|
-
let(:pct_app_number) { PctAppNumber.new(' SG2012000001') }
|
47
|
-
|
48
|
-
it "is valid" do
|
49
|
-
expect(pct_app_number).to be_valid
|
50
|
-
end
|
51
|
-
|
52
|
-
it "validates" do
|
53
|
-
expect { pct_app_number.validate }.to_not raise_error
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
describe "trailing space after application number" do
|
58
|
-
let(:pct_app_number) { PctAppNumber.new('SG2012000001 ') }
|
59
|
-
|
60
|
-
it "is valid" do
|
61
|
-
expect(pct_app_number).to be_valid
|
62
|
-
end
|
63
|
-
|
64
|
-
it "validates" do
|
65
|
-
expect { pct_app_number.validate }.to_not raise_error
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
describe "non-existent applications" do
|
70
|
-
let(:pct_app_number) { PctAppNumber.new('SG2012999999') }
|
71
|
-
|
72
|
-
it "is valid even when application doesn't exist" do
|
73
|
-
expect(pct_app_number).to be_valid
|
74
|
-
end
|
75
|
-
|
76
|
-
it "validates" do
|
77
|
-
expect { pct_app_number.validate }.to_not raise_error
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
describe "application number prefixed with PCT" do
|
82
|
-
let(:pct_app_number) { PctAppNumber.new('PCTSG2012000001') }
|
83
|
-
|
84
|
-
it "is valid" do
|
85
|
-
expect(pct_app_number).to be_valid
|
86
|
-
end
|
87
|
-
|
88
|
-
it "validates" do
|
89
|
-
expect { pct_app_number.validate }.to_not raise_error
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
describe "application number prefixed with PCT/" do
|
94
|
-
let(:pct_app_number) { PctAppNumber.new('PCT/SG2012000001') }
|
95
|
-
|
96
|
-
it "is valid" do
|
97
|
-
expect(pct_app_number).to be_valid
|
98
|
-
end
|
99
|
-
|
100
|
-
it "validates" do
|
101
|
-
expect { pct_app_number.validate }.to_not raise_error
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
describe "application number prefixed with PCT/, slash between year and number" do
|
106
|
-
let(:pct_app_number) { PctAppNumber.new('PCT/SG2012/000001') }
|
107
|
-
|
108
|
-
it "is valid" do
|
109
|
-
expect(pct_app_number).to be_valid
|
110
|
-
end
|
111
|
-
|
112
|
-
it "validates" do
|
113
|
-
expect { pct_app_number.validate }.to_not raise_error
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
describe "lowercase" do
|
118
|
-
let(:pct_app_number) { PctAppNumber.new('pct/sg2012/000001') }
|
119
|
-
|
120
|
-
it "is valid" do
|
121
|
-
expect(pct_app_number).to be_valid
|
122
|
-
end
|
123
|
-
|
124
|
-
it "validates" do
|
125
|
-
expect { pct_app_number.validate }.to_not raise_error
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
describe "mixed case" do
|
130
|
-
let(:pct_app_number) { PctAppNumber.new('pCt/sG2012000001') }
|
131
|
-
|
132
|
-
it "is valid" do
|
133
|
-
expect(pct_app_number).to be_valid
|
134
|
-
end
|
135
|
-
|
136
|
-
it "validates" do
|
137
|
-
expect { pct_app_number.validate }.to_not raise_error
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
describe "application numbers not in acceptable format" do
|
143
|
-
|
144
|
-
describe "no application number" do
|
145
|
-
let(:pct_app_number) { PctAppNumber.new('') }
|
146
|
-
|
147
|
-
it "is not valid" do
|
148
|
-
expect(pct_app_number).to_not be_valid
|
149
|
-
end
|
150
|
-
|
151
|
-
it "does not validate" do
|
152
|
-
expect { pct_app_number.validate }.to raise_error
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
describe "blank application number" do
|
157
|
-
let(:pct_app_number) { PctAppNumber.new(' ') }
|
158
|
-
|
159
|
-
it "is not valid" do
|
160
|
-
expect(pct_app_number).to_not be_valid
|
161
|
-
end
|
162
|
-
|
163
|
-
it "does not validate" do
|
164
|
-
expect { pct_app_number.validate }.to raise_error
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
describe "incorrectly formatted application numbers" do
|
169
|
-
|
170
|
-
describe "application number is too short" do
|
171
|
-
let(:pct_app_number) { PctAppNumber.new('SG201200001') }
|
172
|
-
|
173
|
-
it "is not valid" do
|
174
|
-
expect(pct_app_number).to_not be_valid
|
175
|
-
end
|
176
|
-
|
177
|
-
it "does not validate" do
|
178
|
-
expect { pct_app_number.validate }.to raise_error
|
179
|
-
end
|
180
|
-
end
|
181
|
-
|
182
|
-
describe "application number is too long" do
|
183
|
-
let(:pct_app_number) { PctAppNumber.new('SG20120000011') }
|
184
|
-
|
185
|
-
it "is not valid" do
|
186
|
-
expect(pct_app_number).to_not be_valid
|
187
|
-
end
|
188
|
-
|
189
|
-
it "does not validate" do
|
190
|
-
expect { pct_app_number.validate }.to raise_error
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
describe "application number contains non-digits" do
|
195
|
-
let(:pct_app_number) { PctAppNumber.new('SG2012A00001') }
|
196
|
-
|
197
|
-
it "is not valid" do
|
198
|
-
expect(pct_app_number).to_not be_valid
|
199
|
-
end
|
200
|
-
|
201
|
-
it "does not validate" do
|
202
|
-
expect { pct_app_number.validate }.to raise_error
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
describe "application number has more than one slash" do
|
207
|
-
let(:pct_app_number) { PctAppNumber.new('SG2012//000001') }
|
208
|
-
|
209
|
-
it "is not valid" do
|
210
|
-
expect(pct_app_number).to_not be_valid
|
211
|
-
end
|
212
|
-
|
213
|
-
it "does not validate" do
|
214
|
-
expect { pct_app_number.validate }.to raise_error
|
215
|
-
end
|
216
|
-
end
|
217
|
-
end
|
218
|
-
end
|
219
|
-
end
|
220
|
-
|
221
|
-
describe "to_ia_number method" do
|
222
|
-
context "uppercase letters" do
|
223
|
-
it "converts to an ia_number" do
|
224
|
-
expect(PctAppNumber.new('SG2012000001').to_ia_number).to eq('SG2012000001')
|
225
|
-
expect(PctAppNumber.new('SG2012/000001').to_ia_number).to eq('SG2012000001')
|
226
|
-
expect(PctAppNumber.new('PCTSG2012000001').to_ia_number).to eq('SG2012000001')
|
227
|
-
expect(PctAppNumber.new('PCT/SG2012000001').to_ia_number).to eq('SG2012000001')
|
228
|
-
expect(PctAppNumber.new('PCTSG2012/000001').to_ia_number).to eq('SG2012000001')
|
229
|
-
expect(PctAppNumber.new('PCT/SG2012/000001').to_ia_number).to eq('SG2012000001')
|
230
|
-
end
|
231
|
-
end
|
232
|
-
|
233
|
-
context "lowercase letters" do
|
234
|
-
it "converts to an ia_number" do
|
235
|
-
expect(PctAppNumber.new('sg2012000001').to_ia_number).to eq('SG2012000001')
|
236
|
-
expect(PctAppNumber.new('sg2012/000001').to_ia_number).to eq('SG2012000001')
|
237
|
-
expect(PctAppNumber.new('pctsg2012000001').to_ia_number).to eq('SG2012000001')
|
238
|
-
expect(PctAppNumber.new('pct/sg2012000001').to_ia_number).to eq('SG2012000001')
|
239
|
-
expect(PctAppNumber.new('pctsg2012/000001').to_ia_number).to eq('SG2012000001')
|
240
|
-
expect(PctAppNumber.new('pct/sg2012/000001').to_ia_number).to eq('SG2012000001')
|
241
|
-
end
|
242
|
-
end
|
243
|
-
|
244
|
-
context "mixed case letters" do
|
245
|
-
it "converts to an ia_number" do
|
246
|
-
expect(PctAppNumber.new('sG2012000001').to_ia_number).to eq('SG2012000001')
|
247
|
-
expect(PctAppNumber.new('sG2012/000001').to_ia_number).to eq('SG2012000001')
|
248
|
-
expect(PctAppNumber.new('pCtsG2012000001').to_ia_number).to eq('SG2012000001')
|
249
|
-
expect(PctAppNumber.new('pCt/sG2012000001').to_ia_number).to eq('SG2012000001')
|
250
|
-
expect(PctAppNumber.new('pCtsG2012/000001').to_ia_number).to eq('SG2012000001')
|
251
|
-
expect(PctAppNumber.new('pCt/sG2012/000001').to_ia_number).to eq('SG2012000001')
|
252
|
-
end
|
253
|
-
end
|
254
|
-
end
|
255
|
-
end
|
256
|
-
end
|