Dex 0.1.1 → 0.1.2

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.
data/README.md CHANGED
@@ -22,7 +22,7 @@ Usage
22
22
 
23
23
  require "Dex"
24
24
 
25
- Dex.db "./my_log.db"
25
+ Dex.db "my_log.db"
26
26
 
27
27
  begin
28
28
  raise
data/lib/Dex.rb CHANGED
@@ -28,7 +28,7 @@ class Dex
28
28
  if name != :_RETURN_
29
29
  @db = begin
30
30
  db_file name
31
- db = Sequel.connect "sqlite://#{db_file}"
31
+ db = Sequel.sqlite db_file
32
32
  db.create_table?(Dex.default_table) {
33
33
 
34
34
  primary_key :id
@@ -1,3 +1,3 @@
1
1
  class Dex
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -2,15 +2,37 @@
2
2
  describe "Dex :db" do
3
3
 
4
4
  it "resets :table to nil after specifying a new Database" do
5
- t = Class.new {
6
- include Dex::DSL
7
- }.new
5
+ t = new_dex
8
6
  t.db "/tmp/db.test.1.db"
9
7
  t.table.count
10
8
  t.db "/tmp/db.test.2.db"
11
9
  t.instance_eval { @table }.should.be == nil
12
10
  end
13
11
 
12
+ it "allows file names with underscores: my_log.db" do
13
+ file = 'my_log.db'
14
+ begin
15
+ should.not.raise {
16
+ db = new_dex
17
+ db.db file
18
+ }
19
+ ensure
20
+ File.unlink file if File.exists?(file)
21
+ end
22
+ end
23
+
24
+ it "allows relative file names" do
25
+ file = './my_log.db'
26
+ begin
27
+ should.not.raise {
28
+ db = new_dex
29
+ db.db file
30
+ }
31
+ ensure
32
+ File.unlink file if File.exists?(file)
33
+ end
34
+ end
35
+
14
36
  end # === Dex :db
15
37
 
16
38
  describe "Dex :recent" do
@@ -54,6 +54,10 @@ def transact
54
54
  }
55
55
  end
56
56
 
57
+ def new_dex
58
+ @t ||= Class.new { include Dex::DSL }
59
+ @t.new
60
+ end
57
61
 
58
62
  def except name
59
63
  err = nil
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Dex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: