hyperion-sqlite 0.0.1.alpha5 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,11 @@
1
- require 'hyperion/api'
1
+ require 'hyperion'
2
2
 
3
3
  module Hyperion
4
4
  module Sqlite
5
5
  class DbStrategy
6
6
 
7
7
  def process_result(given_record, result)
8
- if API.new?(given_record)
8
+ if Hyperion.new?(given_record)
9
9
  given_record.merge('id' => result.insert_id)
10
10
  else
11
11
  given_record
@@ -8,7 +8,7 @@ module Hyperion
8
8
  module Sqlite
9
9
 
10
10
  def self.new(opts={})
11
- Sql::Datastore.new(DbStrategy.new, QueryExecutorStrategy.new, QueryBuilderStrategy.new)
11
+ Sql::Datastore.new(opts[:connection_url], DbStrategy.new, QueryExecutorStrategy.new, QueryBuilderStrategy.new)
12
12
  end
13
13
 
14
14
  end
@@ -5,6 +5,8 @@ require 'hyperion/sqlite'
5
5
 
6
6
  describe Hyperion::Sqlite do
7
7
 
8
+ CONNECTION_URL = 'sqlite3::memory:'
9
+
8
10
  def execute(query)
9
11
  Hyperion::Sql.connection.create_command(query).execute_non_query
10
12
  end
@@ -24,25 +26,35 @@ describe Hyperion::Sqlite do
24
26
  execute "DROP TABLE IF EXISTS #{table_name};"
25
27
  end
26
28
 
29
+ TABLES = ['testing', 'other_testing']
30
+
27
31
  around :each do |example|
28
- Hyperion::Sql.with_connection_and_ds('sqlite3::memory:', :sqlite) do
32
+ Hyperion.with_datastore(:sqlite, :connection_url => CONNECTION_URL) do
29
33
  example.run
30
34
  end
31
35
  end
32
36
 
33
- context 'Datastore' do
37
+ before :each do |example|
38
+ Hyperion::Sql.with_connection(CONNECTION_URL) do
39
+ TABLES.each { |table| create_table(table) }
40
+ end
41
+ end
42
+
43
+ after :each do |example|
44
+ Hyperion::Sql.with_connection(CONNECTION_URL) do
45
+ TABLES.each { |table| drop_table(table) }
46
+ end
47
+ end
48
+
49
+ include_examples 'Datastore'
50
+
51
+ context 'Transactions' do
34
52
  around :each do |example|
35
- Hyperion::Sql.rollback do
36
- tables = ['testing', 'other_testing']
37
- tables.each do |table|
38
- create_table(table)
39
- end
53
+ Hyperion::Sql.with_connection(CONNECTION_URL) do
40
54
  example.run
41
55
  end
42
56
  end
43
57
 
44
- include_examples 'Datastore'
58
+ include_examples 'Sql Transactions'
45
59
  end
46
-
47
- it_behaves_like 'Sql Transactions'
48
60
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyperion-sqlite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.alpha5
5
- prerelease: 6
4
+ version: 0.1.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
- - 8th Light, Inc.
8
+ - Steve Kim
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-18 00:00:00.000000000 Z
12
+ date: 2012-10-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - '='
36
36
  - !ruby/object:Gem::Version
37
- version: 0.0.1.alpha5
37
+ version: 0.1.0
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - '='
44
44
  - !ruby/object:Gem::Version
45
- version: 0.0.1.alpha5
45
+ version: 0.1.0
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: do_sqlite3
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -61,7 +61,6 @@ dependencies:
61
61
  version: 0.10.8
62
62
  description: SQLite Datastore for Hyperion
63
63
  email:
64
- - myles@8thlight.com
65
64
  - skim@8thlight.com
66
65
  executables: []
67
66
  extensions: []
@@ -88,9 +87,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
88
87
  required_rubygems_version: !ruby/object:Gem::Requirement
89
88
  none: false
90
89
  requirements:
91
- - - ! '>'
90
+ - - ! '>='
92
91
  - !ruby/object:Gem::Version
93
- version: 1.3.1
92
+ version: '0'
94
93
  requirements: []
95
94
  rubyforge_project:
96
95
  rubygems_version: 1.8.24