poefy-sqlite3 0.1.0 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 601ccce9d7cf3212b804700e0071548fe4e88669
4
- data.tar.gz: 6619ec5b781ff1677302925782bd86369dc484e9
3
+ metadata.gz: 8806b7669ce6afbcea42c28575acb64b355e021a
4
+ data.tar.gz: b15888762fcb9e759934545eb8f634bfbe5cd8b5
5
5
  SHA512:
6
- metadata.gz: 51a75059555a8147f33b70776fe1d17255e487d4b0e8f77e708b61a1cf1e1240a861625a6810a83c72f882022800ada63bbb67ec8c1f52de6e1ae719fac4e5a0
7
- data.tar.gz: 66644fda8fd56121eeedc553958136a917a0a0e9f7fd2de5952f3258eb6972a1c34dcd89904d4c5ff5ae2ba47e9c33c0b87d3422215b4d3f980503fe4d8cf780
6
+ metadata.gz: de5980e39718fdf884bac2c715915ed88ac7296a8150843e14af004caab42fd9c72e080ff383ec2eb7dba2326591e532b167cf172a3f6cbfd948bf7e4b79779a
7
+ data.tar.gz: e330587bdbe424830769e1b7b6104fad7b305a4aef621d3864556968c1204705b868bff5e907fb39a259cb2c236c00b9cb796480f14a176e588ad8f32583433a
data/lib/poefy/sqlite3.rb CHANGED
@@ -231,9 +231,9 @@ module Poefy
231
231
  @sproc[key] = db.prepare value
232
232
  end
233
233
  rescue
234
- handle_error \
235
- "ERROR: Database table structure is invalid.\n" +
236
- " Please manually DROP the corrupt table and recreate it."
234
+ msg = "ERROR: Database table structure is invalid." +
235
+ "\n Please manually DROP the corrupt table and recreate it."
236
+ raise Poefy::StructureInvalid.new(msg)
237
237
  end
238
238
 
239
239
  # Find rhymes and counts greater than a certain length.
@@ -6,7 +6,7 @@ module Poefy
6
6
  module Sqlite3
7
7
 
8
8
  def self.version_number
9
- major = 0
9
+ major = 1
10
10
  minor = 1
11
11
  tiny = 0
12
12
  pre = nil
@@ -16,7 +16,7 @@ module Poefy
16
16
  end
17
17
 
18
18
  def self.version_date
19
- '2017-10-02'
19
+ '2017-10-31'
20
20
  end
21
21
 
22
22
  end
@@ -26,6 +26,6 @@ Gem::Specification.new do |s|
26
26
  s.add_development_dependency('rspec', '~> 3.0')
27
27
  s.add_development_dependency('ruby_rhymes', '~> 0.1')
28
28
 
29
- s.add_runtime_dependency('poefy', '~> 1.0', '>= 1.0.0')
29
+ s.add_runtime_dependency('poefy', '~> 1.1', '>= 1.1.0')
30
30
  s.add_runtime_dependency('sqlite3', '~> 1.3', '>= 1.3.13')
31
31
  end
@@ -119,26 +119,31 @@ describe Poefy::Poem, "-- SQLite" do
119
119
 
120
120
  describe ":rhyme option" do
121
121
 
122
- describe "should return nil" do
122
+ describe "should raise Poefy::MissingFormOrRhyme" do
123
123
  it "blank, no argument" do
124
- poem = @poefy.poem
125
- expect(poem).to be_nil
124
+ expect {
125
+ @poefy.poem
126
+ }.to raise_error(Poefy::MissingFormOrRhyme)
126
127
  end
127
128
  it "({ })" do
128
- poem = @poefy.poem ({ })
129
- expect(poem).to be_nil
129
+ expect {
130
+ @poefy.poem ({ })
131
+ }.to raise_error(Poefy::MissingFormOrRhyme)
130
132
  end
131
133
  it "({ rhyme: nil })" do
132
- poem = @poefy.poem ({ rhyme: nil })
133
- expect(poem).to be_nil
134
+ expect {
135
+ @poefy.poem ({ rhyme: nil })
136
+ }.to raise_error(Poefy::MissingFormOrRhyme)
134
137
  end
135
138
  it "({ rhyme: ' ' })" do
136
- poem = @poefy.poem ({ rhyme: ' ' })
137
- expect(poem).to be_nil
139
+ expect {
140
+ @poefy.poem ({ rhyme: ' ' })
141
+ }.to raise_error(Poefy::MissingFormOrRhyme)
138
142
  end
139
143
  it "({ rhyme: '' })" do
140
- poem = @poefy.poem ({ rhyme: '' })
141
- expect(poem).to be_nil
144
+ expect {
145
+ @poefy.poem ({ rhyme: '' })
146
+ }.to raise_error(Poefy::MissingFormOrRhyme)
142
147
  end
143
148
  end
144
149
 
@@ -165,23 +170,25 @@ describe Poefy::Poem, "-- SQLite" do
165
170
  end
166
171
  end
167
172
 
168
- describe "should be nil if can't parse rhyme string" do
173
+ describe "should raise error if can't parse rhyme string" do
169
174
  rhymes = %w{a1 b1 ab1 Ab1 AAAAABb1 1 1111 1122 11221 ;;::1. }
170
175
  rhymes += ['AA Bb1','11 11','11 1 1','..1.']
171
176
  rhymes.each do |i|
172
177
  it "({ rhyme: '#{i}' })" do
173
- poem = @poefy.poem ({ rhyme: i })
174
- expect(poem).to be_nil
178
+ expect {
179
+ @poefy.poem ({ rhyme: i })
180
+ }.to raise_error(Poefy::RhymeError)
175
181
  end
176
182
  end
177
183
  end
178
184
 
179
- describe "should be nil if can't complete rhyme string" do
185
+ describe "should raise error if can't complete rhyme string" do
180
186
  rhymes = %w{aaaaaa abcd aaaaabbbbb}
181
187
  rhymes.each do |i|
182
188
  it "({ rhyme: '#{i}' })" do
183
- poem = @poefy.poem ({ rhyme: i })
184
- expect(poem).to be_nil
189
+ expect {
190
+ @poefy.poem ({ rhyme: i })
191
+ }.to raise_error(Poefy::NotEnoughData)
185
192
  end
186
193
  end
187
194
  end
@@ -201,12 +208,13 @@ describe Poefy::Poem, "-- SQLite" do
201
208
  end
202
209
  end
203
210
 
204
- describe "should be nil if can't complete repeating rhyme string" do
211
+ describe "should raise error if can't complete repeating rhyme string" do
205
212
  lines = 200
206
213
  it "({ rhyme: ('A'..'D').to_a.map { |i| i * #{lines} }.join })" do
207
214
  rhyme = ('A'..'D').to_a.map { |i| i * lines }.join
208
- poem = @poefy.poem ({ rhyme: rhyme })
209
- expect(poem).to be_nil
215
+ expect {
216
+ @poefy.poem ({ rhyme: rhyme })
217
+ }.to raise_error(Poefy::NotEnoughData)
210
218
  end
211
219
  end
212
220
 
@@ -221,29 +229,34 @@ describe Poefy::Poem, "-- SQLite" do
221
229
  end
222
230
  end
223
231
 
224
- describe "should be nil if given a named form it can't fulfil" do
232
+ describe "should raise error if given a named form it can't fulfil" do
225
233
  it "({ form: 'sonnet' })" do
226
- poem = @poefy.poem ({ form: 'sonnet' })
227
- expect(poem).to be_nil
234
+ expect {
235
+ @poefy.poem ({ form: 'sonnet' })
236
+ }.to raise_error(Poefy::NotEnoughData)
228
237
  end
229
238
  it "({ form: :villanelle })" do
230
- poem = @poefy.poem ({ form: :villanelle })
231
- expect(poem).to be_nil
239
+ expect {
240
+ @poefy.poem ({ form: 'villanelle' })
241
+ }.to raise_error(Poefy::NotEnoughData)
232
242
  end
233
243
  end
234
244
 
235
- describe "should be nil if given a junk named form" do
245
+ describe "should raise error if given a junk named form" do
236
246
  it "({ form: 'sonnet_junk' })" do
237
- poem = @poefy.poem ({ form: 'sonnet_junk' })
238
- expect(poem).to be_nil
247
+ expect {
248
+ @poefy.poem ({ form: 'sonnet_junk' })
249
+ }.to raise_error(Poefy::MissingFormOrRhyme)
239
250
  end
240
251
  it "({ form: :not_a_form })" do
241
- poem = @poefy.poem ({ form: :not_a_form })
242
- expect(poem).to be_nil
252
+ expect {
253
+ @poefy.poem ({ form: :not_a_form })
254
+ }.to raise_error(Poefy::MissingFormOrRhyme)
243
255
  end
244
256
  it "({ form: :not_a_form, indent: '0010' })" do
245
- poem = @poefy.poem ({ form: :not_a_form, indent: '0010' })
246
- expect(poem).to be_nil
257
+ expect {
258
+ @poefy.poem ({ form: :not_a_form, indent: '0010' })
259
+ }.to raise_error(Poefy::MissingFormOrRhyme)
247
260
  end
248
261
  end
249
262
 
@@ -308,11 +321,12 @@ describe Poefy::Poem, "-- SQLite" do
308
321
  expect(poem.count).to be 14
309
322
  end
310
323
  end
311
- describe "should fail to be created" do
324
+ describe "should raise Poefy::NotEnoughData" do
312
325
  it "({ form: :sonnet, acrostic: 'qqqqqqqqqqqqqq' })" do
313
- poem = @poefy.poem ({ form: :sonnet,
314
- acrostic: 'qqqqqqqqqqqqqq' })
315
- expect(poem).to be_nil
326
+ expect {
327
+ @poefy.poem ({ form: :sonnet,
328
+ acrostic: 'qqqqqqqqqqqqqq' })
329
+ }.to raise_error(Poefy::NotEnoughData)
316
330
  end
317
331
  end
318
332
  end
@@ -336,12 +350,13 @@ describe Poefy::Poem, "-- SQLite" do
336
350
  end
337
351
  end
338
352
 
339
- describe "should fail to be created" do
353
+ describe "should raise Poefy::NotEnoughData" do
340
354
  forms_fail.each do |form|
341
355
  it "({ form: #{form} })" do
342
356
  4.times do
343
- poem = @poefy.poem ({ form: form })
344
- expect(poem).to be_nil
357
+ expect {
358
+ @poefy.poem ({ form: form })
359
+ }.to raise_error(Poefy::NotEnoughData)
345
360
  end
346
361
  end
347
362
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poefy-sqlite3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Thompson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-02 00:00:00.000000000 Z
11
+ date: 2017-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,20 +72,20 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.0'
75
+ version: '1.1'
76
76
  - - ">="
77
77
  - !ruby/object:Gem::Version
78
- version: 1.0.0
78
+ version: 1.1.0
79
79
  type: :runtime
80
80
  prerelease: false
81
81
  version_requirements: !ruby/object:Gem::Requirement
82
82
  requirements:
83
83
  - - "~>"
84
84
  - !ruby/object:Gem::Version
85
- version: '1.0'
85
+ version: '1.1'
86
86
  - - ">="
87
87
  - !ruby/object:Gem::Version
88
- version: 1.0.0
88
+ version: 1.1.0
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: sqlite3
91
91
  requirement: !ruby/object:Gem::Requirement