database_cleaner 0.6.7 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -127,6 +127,7 @@ GEM
127
127
  linecache (>= 0.3)
128
128
  rubyforge (2.0.4)
129
129
  json_pure (>= 1.1.7)
130
+ sequel (3.21.0)
130
131
  sqlite3-ruby (1.3.1)
131
132
  stringex (1.1.0)
132
133
  sys-uname (0.8.4)
@@ -157,5 +158,6 @@ DEPENDENCIES
157
158
  rspactor
158
159
  rspec
159
160
  ruby-debug
161
+ sequel (~> 3.21.0)
160
162
  sqlite3-ruby
161
163
  tzinfo (= 0.3.22)
data/History.txt CHANGED
@@ -1,4 +1,19 @@
1
- == 0.6.x (in git)
1
+ == 0.7.x (in git)
2
+
3
+ == 0.7.0 2011-11-12
4
+
5
+ === New Features
6
+
7
+ * Sequel Support (Corin Langosch)
8
+ * Updates DataMapper strategies to work with DataMapper 1.1 (Xavier Shay and Anthony Williams)
9
+ * for AR and PSQL, truncate all tables with one command, improving performance due to avoiding cascades (Leonid Shevtsov)
10
+
11
+ === Bugfixes
12
+
13
+ * Avoids trying to load the ':default' ActiveRecord config. #72 (Ben Mabey)
14
+
15
+
16
+ == 0.6.7 2011-04-21
2
17
 
3
18
  === Bugfixes
4
19
  * Explicity require ERB. (Vít Ondruch)
data/README.textile CHANGED
@@ -73,7 +73,7 @@ strategy the remaining time. To accomplish this you can say:
73
73
  Example usage with RSpec:
74
74
 
75
75
  <pre>
76
- Spec::Runner.configure do |config|
76
+ RSpec.configure do |config|
77
77
 
78
78
  config.before(:suite) do
79
79
  DatabaseCleaner.strategy = :transaction
@@ -99,6 +99,12 @@ In rare cases DatabaseCleaner will encounter errors that it will log. By defaul
99
99
  DatabaseCleaner.logger = Rails.logger
100
100
  </pre>
101
101
 
102
+ If you are using Postgres and have foreign key constraints, the truncation strategy will cause a lot of extra noise to appear on STDERR (in
103
+ the form of "NOTICE truncate cascades" messages). To silence these warnings set the following log level in your postgresql.conf file:
104
+
105
+ <pre>
106
+ client_min_messages = warning
107
+ </pre>
102
108
 
103
109
  h2. How to use with multiple ORM's
104
110
 
data/Rakefile CHANGED
@@ -56,7 +56,7 @@ task :clean do
56
56
  "examples/db/datamapper_one.db", "examples/db/datamapper_two.db"].each do |f|
57
57
  FileUtils.rm_f(f)
58
58
  end
59
- %w[*.sqlite3 *.log].each do |pattern|
59
+ %w[*.sqlite3 *.log #* *.swp *.swo].each do |pattern|
60
60
  `find . -name "#{pattern}" -delete`
61
61
  end
62
62
  end
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- :patch: 7
3
2
  :major: 0
4
3
  :build:
5
- :minor: 6
4
+ :minor: 7
5
+ :patch: 0
data/examples/Gemfile CHANGED
@@ -32,6 +32,7 @@ group :development do
32
32
  gem "tzinfo", "0.3.22"
33
33
  gem "mongo_mapper", "0.8.2"
34
34
  gem "couch_potato", "0.3.0"
35
+ gem "sequel", "~>3.21.0"
35
36
  #gem "ibm_db" # I don't want to add this dependency, even as a dev one since it requires DB2 to be installed
36
37
  end
37
38
 
@@ -127,6 +127,7 @@ GEM
127
127
  linecache (>= 0.3)
128
128
  rubyforge (2.0.4)
129
129
  json_pure (>= 1.1.7)
130
+ sequel (3.21.0)
130
131
  sqlite3-ruby (1.3.1)
131
132
  stringex (1.1.0)
132
133
  sys-uname (0.8.4)
@@ -157,5 +158,6 @@ DEPENDENCIES
157
158
  rspactor
158
159
  rspec
159
160
  ruby-debug
161
+ sequel (~> 3.21.0)
160
162
  sqlite3-ruby
161
163
  tzinfo (= 0.3.22)
@@ -8,7 +8,7 @@ module DatabaseCleaner
8
8
  def self.available_strategies
9
9
  %w[truncation transaction deletion]
10
10
  end
11
-
11
+
12
12
  def self.config_file_location=(path)
13
13
  @config_file_location = path
14
14
  end
@@ -32,9 +32,9 @@ module DatabaseCleaner
32
32
  end
33
33
 
34
34
  def load_config
35
- if File.file?(ActiveRecord.config_file_location)
35
+ if self.db != :default && File.file?(ActiveRecord.config_file_location)
36
36
  connection_details = YAML::load(ERB.new(IO.read(ActiveRecord.config_file_location)).result)
37
- self.connection_hash = connection_details[self.db.to_s]
37
+ @connection_hash = connection_details[self.db.to_s]
38
38
  end
39
39
  end
40
40
 
@@ -53,7 +53,8 @@ module DatabaseCleaner::ActiveRecord
53
53
  class Deletion < Truncation
54
54
 
55
55
  def clean
56
- each_table do |connection, table_name|
56
+ connection = connection_klass.connection
57
+ tables_to_truncate(connection).each do |table_name|
57
58
  connection.delete_table table_name
58
59
  end
59
60
  end
@@ -12,6 +12,16 @@ module ActiveRecord
12
12
  def views
13
13
  @views ||= select_values("select table_name from information_schema.views where table_schema = '#{current_database}'") rescue []
14
14
  end
15
+
16
+ def truncate_table(table_name)
17
+ raise NotImplementedError
18
+ end
19
+
20
+ def truncate_tables(tables)
21
+ tables.each do |table_name|
22
+ self.truncate_table(table_name)
23
+ end
24
+ end
15
25
  end
16
26
 
17
27
  unless USE_ARJDBC_WORKAROUND
@@ -72,7 +82,11 @@ module ActiveRecord
72
82
  end
73
83
 
74
84
  def truncate_table(table_name)
75
- execute("TRUNCATE TABLE #{quote_table_name(table_name)} #{restart_identity} #{cascade};")
85
+ truncate_tables([table_name])
86
+ end
87
+
88
+ def truncate_tables(table_names)
89
+ execute("TRUNCATE TABLE #{table_names.map{|name| quote_table_name(name)}.join(', ')} #{restart_identity} #{cascade};")
76
90
  end
77
91
 
78
92
  end
@@ -103,17 +117,9 @@ module DatabaseCleaner::ActiveRecord
103
117
  include ::DatabaseCleaner::Generic::Truncation
104
118
 
105
119
  def clean
106
- each_table do |connection, table_name|
107
- connection.truncate_table table_name
108
- end
109
- end
110
-
111
- def each_table
112
120
  connection = connection_klass.connection
113
121
  connection.disable_referential_integrity do
114
- tables_to_truncate(connection).each do |table_name|
115
- yield connection, table_name
116
- end
122
+ connection.truncate_tables(tables_to_truncate(connection))
117
123
  end
118
124
  end
119
125
 
@@ -118,15 +118,17 @@ module DatabaseCleaner
118
118
  :mongoid
119
119
  elsif defined? ::CouchPotato
120
120
  :couch_potato
121
+ elsif defined? ::Sequel
122
+ :sequel
121
123
  else
122
- raise NoORMDetected, "No known ORM was detected! Is ActiveRecord, DataMapper, MongoMapper, Mongoid, or CouchPotato loaded?"
124
+ raise NoORMDetected, "No known ORM was detected! Is ActiveRecord, DataMapper, Sequel, MongoMapper, Mongoid, or CouchPotato loaded?"
123
125
  end
124
126
  end
125
127
  end
126
128
 
127
129
  def set_default_orm_strategy
128
130
  case orm
129
- when :active_record, :data_mapper
131
+ when :active_record, :data_mapper, :sequel
130
132
  self.strategy = :transaction
131
133
  when :mongo_mapper, :mongoid, :couch_potato
132
134
  self.strategy = :truncation
@@ -25,48 +25,48 @@ module DatabaseCleaner
25
25
  def connections
26
26
  @connections ||= [::DatabaseCleaner::Base.new]
27
27
  end
28
-
28
+
29
29
  def logger=(log_source)
30
30
  @logger = log_source
31
31
  end
32
32
 
33
33
  def logger
34
34
  return @logger if @logger
35
-
35
+
36
36
  @logger = Logger.new(STDOUT)
37
37
  @logger.level = Logger::ERROR
38
38
  @logger
39
39
  end
40
40
 
41
41
  def strategy=(stratagem)
42
- self.connections.each { |connect| connect.strategy = stratagem }
42
+ connections.each { |connect| connect.strategy = stratagem }
43
43
  remove_duplicates
44
44
  end
45
45
 
46
46
  def orm=(orm)
47
- self.connections.each { |connect| connect.orm = orm }
47
+ connections.each { |connect| connect.orm = orm }
48
48
  remove_duplicates
49
49
  end
50
50
 
51
51
  def start
52
- self.connections.each { |connection| connection.start }
52
+ connections.each { |connection| connection.start }
53
53
  end
54
54
 
55
55
  def clean
56
- self.connections.each { |connection| connection.clean }
56
+ connections.each { |connection| connection.clean }
57
57
  end
58
58
 
59
59
  alias clean! clean
60
60
 
61
61
  def clean_with(*args)
62
- self.connections.each { |connection| connection.clean_with(*args) }
62
+ connections.each { |connection| connection.clean_with(*args) }
63
63
  end
64
64
 
65
65
  alias clean_with! clean_with
66
66
 
67
67
  def remove_duplicates
68
68
  temp = []
69
- self.connections.each do |connect|
69
+ connections.each do |connect|
70
70
  temp.push connect unless temp.include? connect
71
71
  end
72
72
  @connections = temp
@@ -86,6 +86,8 @@ module DatabaseCleaner
86
86
  DatabaseCleaner::MongoMapper
87
87
  when :couch_potato
88
88
  DatabaseCleaner::CouchPotato
89
+ when :sequel
90
+ DatabaseCleaner::Sequel
89
91
  end
90
92
  end
91
93
  end
@@ -42,7 +42,7 @@ module DataMapper
42
42
  # taken from http://github.com/godfat/dm-mapping/tree/master
43
43
  def storage_names(repository = :default)
44
44
  # activerecord-2.1.0/lib/active_record/connection_adapters/sqlite_adapter.rb: 177
45
- sql = <<-SQL.compress_lines
45
+ sql = <<-SQL
46
46
  SELECT name
47
47
  FROM sqlite_master
48
48
  WHERE type = 'table' AND NOT name = 'sqlite_sequence'
@@ -68,7 +68,7 @@ module DataMapper
68
68
  # taken from http://github.com/godfat/dm-mapping/tree/master
69
69
  def storage_names(repository = :default)
70
70
  # activerecord-2.1.0/lib/active_record/connection_adapters/sqlite_adapter.rb: 177
71
- sql = <<-SQL.compress_lines
71
+ sql = <<-SQL
72
72
  SELECT name
73
73
  FROM sqlite_master
74
74
  WHERE type = 'table' AND NOT name = 'sqlite_sequence'
@@ -99,7 +99,7 @@ module DataMapper
99
99
 
100
100
  # taken from http://github.com/godfat/dm-mapping/tree/master
101
101
  def storage_names(repository = :default)
102
- sql = <<-SQL.compress_lines
102
+ sql = <<-SQL
103
103
  SELECT table_name FROM "information_schema"."tables"
104
104
  WHERE table_schema = current_schema() and table_type = 'BASE TABLE'
105
105
  SQL
@@ -4,13 +4,10 @@ module ::DatabaseCleaner
4
4
 
5
5
  def self.included(base)
6
6
  base.extend(ClassMethods)
7
- base.send(:include, InstanceMethods)
8
7
  end
9
8
 
10
- module InstanceMethods
11
- def db
12
- :default
13
- end
9
+ def db
10
+ :default
14
11
  end
15
12
 
16
13
  module ClassMethods
@@ -0,0 +1,22 @@
1
+ require 'database_cleaner/generic/base'
2
+ module DatabaseCleaner
3
+ module Sequel
4
+ def self.available_strategies
5
+ %w[truncation transaction]
6
+ end
7
+
8
+ module Base
9
+ include ::DatabaseCleaner::Generic::Base
10
+
11
+ def db=(desired_db)
12
+ @db = desired_db
13
+ end
14
+
15
+ def db
16
+ return @db if @db && @db != :default
17
+ raise "As you have more than one active sequel database you have to specify the one to use manually!" if ::Sequel::DATABASES.count > 1
18
+ ::Sequel::DATABASES.first || :default
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,20 @@
1
+ require 'database_cleaner/sequel/base'
2
+ module DatabaseCleaner
3
+ module Sequel
4
+ class Transaction
5
+ include ::DatabaseCleaner::Sequel::Base
6
+
7
+ def start
8
+ @transactions ||= []
9
+ db.send(:add_transaction)
10
+ @transactions << db.send(:begin_transaction, db)
11
+ end
12
+
13
+ def clean
14
+ transaction = @transactions.pop
15
+ db.send(:rollback_transaction, transaction)
16
+ db.send(:remove_transaction, transaction)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,31 @@
1
+ require "database_cleaner/generic/truncation"
2
+ require 'database_cleaner/sequel/base'
3
+
4
+ module DatabaseCleaner
5
+ module Sequel
6
+ class Truncation
7
+ include ::DatabaseCleaner::Sequel::Base
8
+ include ::DatabaseCleaner::Generic::Truncation
9
+
10
+ def clean
11
+ each_table do |db, table|
12
+ db[table].truncate
13
+ end
14
+ end
15
+
16
+ def each_table
17
+ tables_to_truncate(db).each do |table|
18
+ yield db, table
19
+ end
20
+ end
21
+
22
+ private
23
+
24
+ def tables_to_truncate(db)
25
+ (@only || db.tables) - @tables_to_exclude
26
+ end
27
+ end
28
+ end
29
+ end
30
+
31
+
@@ -31,19 +31,15 @@ module DatabaseCleaner
31
31
 
32
32
  it "should truncate all tables except for schema_migrations" do
33
33
  connection.stub!(:tables).and_return(%w[schema_migrations widgets dogs])
34
-
35
- connection.should_receive(:truncate_table).with('widgets')
36
- connection.should_receive(:truncate_table).with('dogs')
37
- connection.should_not_receive(:truncate_table).with('schema_migrations')
38
-
34
+
35
+ connection.should_receive(:truncate_tables).with(['widgets', 'dogs'])
39
36
  Truncation.new.clean
40
37
  end
41
38
 
42
39
  it "should only truncate the tables specified in the :only option when provided" do
43
40
  connection.stub!(:tables).and_return(%w[schema_migrations widgets dogs])
44
41
 
45
- connection.should_receive(:truncate_table).with('widgets')
46
- connection.should_not_receive(:truncate_table).with('dogs')
42
+ connection.should_receive(:truncate_tables).with(['widgets'])
47
43
 
48
44
  Truncation.new(:only => ['widgets']).clean
49
45
  end
@@ -51,8 +47,7 @@ module DatabaseCleaner
51
47
  it "should not truncate the tables specified in the :except option" do
52
48
  connection.stub!(:tables).and_return(%w[schema_migrations widgets dogs])
53
49
 
54
- connection.should_receive(:truncate_table).with('dogs')
55
- connection.should_not_receive(:truncate_table).with('widgets')
50
+ connection.should_receive(:truncate_tables).with(['dogs'])
56
51
 
57
52
  Truncation.new(:except => ['widgets']).clean
58
53
  end
@@ -71,8 +66,7 @@ module DatabaseCleaner
71
66
  connection.stub!(:tables).and_return(%w[widgets dogs])
72
67
  connection.stub!(:views).and_return(["widgets"])
73
68
 
74
- connection.should_receive(:truncate_table).with('dogs')
75
- connection.should_not_receive(:truncate_table).with('widgets')
69
+ connection.should_receive(:truncate_tables).with(['dogs'])
76
70
 
77
71
  Truncation.new.clean
78
72
  end
@@ -17,6 +17,7 @@ module DatabaseCleaner
17
17
  Temp_MM = ::MongoMapper if defined?(::MongoMapper) and not defined?(Temp_MM)
18
18
  Temp_MO = ::Mongoid if defined?(::Mongoid) and not defined?(Temp_MO)
19
19
  Temp_CP = ::CouchPotato if defined?(::CouchPotato) and not defined?(Temp_CP)
20
+ Temp_SQ = ::Sequel if defined?(::Sequel) and not defined?(Temp_SQ)
20
21
  end
21
22
 
22
23
  #Remove all ORM mocks and restore from cache
@@ -26,6 +27,7 @@ module DatabaseCleaner
26
27
  Object.send(:remove_const, 'MongoMapper') if defined?(::MongoMapper)
27
28
  Object.send(:remove_const, 'Mongoid') if defined?(::Mongoid)
28
29
  Object.send(:remove_const, 'CouchPotato') if defined?(::CouchPotato)
30
+ Object.send(:remove_const, 'Sequel') if defined?(::Sequel)
29
31
 
30
32
 
31
33
  # Restore ORMs
@@ -43,8 +45,9 @@ module DatabaseCleaner
43
45
  Object.send(:remove_const, 'MongoMapper') if defined?(::MongoMapper)
44
46
  Object.send(:remove_const, 'Mongoid') if defined?(::Mongoid)
45
47
  Object.send(:remove_const, 'CouchPotato') if defined?(::CouchPotato)
48
+ Object.send(:remove_const, 'Sequel') if defined?(::Sequel)
46
49
  end
47
-
50
+
48
51
  let(:cleaner) { DatabaseCleaner::Base.new :autodetect }
49
52
 
50
53
  it "should raise an error when no ORM is detected" do
@@ -57,6 +60,7 @@ module DatabaseCleaner
57
60
  Object.const_set('MongoMapper', 'Mapping mock mongos')
58
61
  Object.const_set('Mongoid', 'Mongoid mock')
59
62
  Object.const_set('CouchPotato', 'Couching mock potatos')
63
+ Object.const_set('Sequel', 'Sequel mock')
60
64
 
61
65
  cleaner.orm.should == :active_record
62
66
  cleaner.should be_auto_detected
@@ -67,6 +71,7 @@ module DatabaseCleaner
67
71
  Object.const_set('MongoMapper', 'Mapping mock mongos')
68
72
  Object.const_set('Mongoid', 'Mongoid mock')
69
73
  Object.const_set('CouchPotato', 'Couching mock potatos')
74
+ Object.const_set('Sequel', 'Sequel mock')
70
75
 
71
76
  cleaner.orm.should == :data_mapper
72
77
  cleaner.should be_auto_detected
@@ -76,6 +81,7 @@ module DatabaseCleaner
76
81
  Object.const_set('MongoMapper', 'Mapping mock mongos')
77
82
  Object.const_set('Mongoid', 'Mongoid mock')
78
83
  Object.const_set('CouchPotato', 'Couching mock potatos')
84
+ Object.const_set('Sequel', 'Sequel mock')
79
85
 
80
86
  cleaner.orm.should == :mongo_mapper
81
87
  cleaner.should be_auto_detected
@@ -84,17 +90,26 @@ module DatabaseCleaner
84
90
  it "should detect Mongoid fourth" do
85
91
  Object.const_set('Mongoid', 'Mongoid mock')
86
92
  Object.const_set('CouchPotato', 'Couching mock potatos')
93
+ Object.const_set('Sequel', 'Sequel mock')
87
94
 
88
95
  cleaner.orm.should == :mongoid
89
96
  cleaner.should be_auto_detected
90
97
  end
91
98
 
92
- it "should detect CouchPotato last" do
99
+ it "should detect CouchPotato fifth" do
93
100
  Object.const_set('CouchPotato', 'Couching mock potatos')
101
+ Object.const_set('Sequel', 'Sequel mock')
94
102
 
95
103
  cleaner.orm.should == :couch_potato
96
104
  cleaner.should be_auto_detected
97
105
  end
106
+
107
+ it "should detect Sequel last" do
108
+ Object.const_set('Sequel', 'Sequel mock')
109
+
110
+ cleaner.orm.should == :sequel
111
+ cleaner.should be_auto_detected
112
+ end
98
113
  end
99
114
 
100
115
  describe "orm_module" do
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+ require 'database_cleaner/sequel/base'
3
+ require 'database_cleaner/shared_strategy_spec'
4
+ require 'sequel'
5
+
6
+ module DatabaseCleaner
7
+ describe Sequel do
8
+ it { should respond_to(:available_strategies) }
9
+ end
10
+
11
+ module Sequel
12
+ class ExampleStrategy
13
+ include ::DatabaseCleaner::Sequel::Base
14
+ end
15
+
16
+ describe ExampleStrategy do
17
+ it_should_behave_like "a generic strategy"
18
+ it { should respond_to(:db) }
19
+ it { should respond_to(:db=) }
20
+
21
+ it "should store my desired db" do
22
+ subject.db = :my_db
23
+ subject.db.should == :my_db
24
+ end
25
+
26
+ it "should default to :default" do
27
+ subject.db.should == :default
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+ require 'database_cleaner/sequel/transaction'
3
+ require 'database_cleaner/shared_strategy_spec'
4
+ require 'sequel'
5
+
6
+ module DatabaseCleaner
7
+ module Sequel
8
+ describe Transaction do
9
+ it_should_behave_like "a generic strategy"
10
+ it_should_behave_like "a generic transaction strategy"
11
+
12
+ describe "start" do
13
+ it "should start a transaction"
14
+ end
15
+
16
+ describe "clean" do
17
+ it "should finish a transaction"
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+ require 'database_cleaner/sequel/truncation'
3
+ require 'database_cleaner/shared_strategy_spec'
4
+ require 'sequel'
5
+
6
+ module DatabaseCleaner
7
+ module Sequel
8
+ describe Truncation do
9
+ it_should_behave_like "a generic strategy"
10
+ it_should_behave_like "a generic truncation strategy"
11
+ end
12
+ end
13
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: database_cleaner
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
5
- prerelease: false
4
+ hash: 3
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
- - 6
9
8
  - 7
10
- version: 0.6.7
9
+ - 0
10
+ version: 0.7.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ben Mabey
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-21 00:00:00 -06:00
19
- default_executable:
18
+ date: 2011-11-12 00:00:00 Z
20
19
  dependencies: []
21
20
 
22
21
  description: Strategies for cleaning databases. Can be used to ensure a clean state for testing.
@@ -63,7 +62,6 @@ files:
63
62
  - features/support/env.rb
64
63
  - features/support/feature_runner.rb
65
64
  - lib/database_cleaner.rb
66
- - lib/database_cleaner/active_record/#transaction.rb#
67
65
  - lib/database_cleaner/active_record/base.rb
68
66
  - lib/database_cleaner/active_record/deletion.rb
69
67
  - lib/database_cleaner/active_record/transaction.rb
@@ -84,6 +82,9 @@ files:
84
82
  - lib/database_cleaner/mongoid/base.rb
85
83
  - lib/database_cleaner/mongoid/truncation.rb
86
84
  - lib/database_cleaner/null_strategy.rb
85
+ - lib/database_cleaner/sequel/base.rb
86
+ - lib/database_cleaner/sequel/transaction.rb
87
+ - lib/database_cleaner/sequel/truncation.rb
87
88
  - spec/database_cleaner/active_record/base_spec.rb
88
89
  - spec/database_cleaner/active_record/transaction_spec.rb
89
90
  - spec/database_cleaner/active_record/truncation_spec.rb
@@ -98,13 +99,15 @@ files:
98
99
  - spec/database_cleaner/mongo_mapper/base_spec.rb
99
100
  - spec/database_cleaner/mongo_mapper/mongo_examples.rb
100
101
  - spec/database_cleaner/mongo_mapper/truncation_spec.rb
102
+ - spec/database_cleaner/sequel/base_spec.rb
103
+ - spec/database_cleaner/sequel/transaction_spec.rb
104
+ - spec/database_cleaner/sequel/truncation_spec.rb
101
105
  - spec/database_cleaner/shared_strategy_spec.rb
102
106
  - spec/rcov.opts
103
107
  - spec/spec.opts
104
108
  - spec/spec_helper.rb
105
109
  - LICENSE
106
110
  - TODO
107
- has_rdoc: true
108
111
  homepage: http://github.com/bmabey/database_cleaner
109
112
  licenses: []
110
113
 
@@ -134,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
137
  requirements: []
135
138
 
136
139
  rubyforge_project:
137
- rubygems_version: 1.3.7
140
+ rubygems_version: 1.8.5
138
141
  signing_key:
139
142
  specification_version: 3
140
143
  summary: Strategies for cleaning databases. Can be used to ensure a clean state for testing.
@@ -153,6 +156,9 @@ test_files:
153
156
  - spec/database_cleaner/mongo_mapper/base_spec.rb
154
157
  - spec/database_cleaner/mongo_mapper/mongo_examples.rb
155
158
  - spec/database_cleaner/mongo_mapper/truncation_spec.rb
159
+ - spec/database_cleaner/sequel/base_spec.rb
160
+ - spec/database_cleaner/sequel/transaction_spec.rb
161
+ - spec/database_cleaner/sequel/truncation_spec.rb
156
162
  - spec/database_cleaner/shared_strategy_spec.rb
157
163
  - spec/spec_helper.rb
158
164
  - examples/features/step_definitions/activerecord_steps.rb
@@ -1,34 +0,0 @@
1
- require 'database_cleaner/active_record/base'
2
- class Foo
3
- def bar
4
- "fdfd"
5
- end
6
- def zaz(x,y)
7
- end
8
- end
9
- module DatabaseCleaner::ActiveRecord
10
- class Transaction
11
- include ::DatabaseCleaner::ActiveRecord::Base
12
-
13
- def start
14
- connection_klass.Foo
15
- if connection_klass.connection.respond_to?(:increment_open_transactions)
16
- connection_klass.connection.increment_open_transactions
17
- else
18
- connection_klass.__send__(:increment_open_transactions)
19
- end
20
- connection_klass.connection.begin_db_transaction
21
- end
22
-
23
-
24
- def clean
25
- connection_klass.connection.rollback_db_transaction
26
-
27
- if connection_klass.connection.respond_to?(:decrement_open_transactions)
28
- connection_klass.connection.decrement_open_transactions
29
- else
30
- connection_klass.__send__(:decrement_open_transactions)
31
- end
32
- end
33
- end
34
- end