bmabey-database_cleaner 0.1.2 → 0.1.3

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/History.txt ADDED
@@ -0,0 +1,22 @@
1
+ (In Git)
2
+
3
+ === New features
4
+ === Bufixes
5
+
6
+ == 0.1.3 2009-04-30
7
+
8
+ === New features
9
+ * PostgresSQLAdapter for AR to support the truncation strategy. (Alberto Perdomo)
10
+ === Bufixes
11
+ * Added missing quotes around table names in truncation calls. (Michael MacDonald)
12
+
13
+ == 0.1.2 2009-03-05
14
+ === New features
15
+ * JDBC Adapter to enable AR truncation strategy to work. (Kamal Fariz Mahyuddin)
16
+
17
+ == 0.1.1 2009-03-04 - Initial Release ( Ben Mabey )
18
+ * Basic infrastructure
19
+ * Features, RSpec code examples
20
+ * ActiveRecord strategies
21
+ * Truncation - with MySQL, and SQLite3 adapters.
22
+ * Transaction - wrap your modifications and roll them back.
data/README.textile CHANGED
@@ -22,11 +22,11 @@ h2. How to use
22
22
 
23
23
  With the :truncation strategy you can also pass in options, for example:
24
24
  <pre>
25
- DatabaseCleaner.strategy = :truncation, {:only => %[widigets dogs some_other_table]}
25
+ DatabaseCleaner.strategy = :truncation, {:only => %w[widgets dogs some_other_table]}
26
26
  </pre>
27
27
 
28
28
  <pre>
29
- DatabaseCleaner.strategy = :truncation, {:except => %[widigets]}
29
+ DatabaseCleaner.strategy = :truncation, {:except => %w[widgets]}
30
30
  </pre>
31
31
 
32
32
  (I should point out the truncation strategy will never truncate your schema_migrations table.)
@@ -56,6 +56,27 @@ strategy the remaining time. To accomplish this you can say:
56
56
  # then make the DatabaseCleaner.start and DatabaseCleaner.clean calls appropriately
57
57
  </pre>
58
58
 
59
+ Example usage with RSpec:
60
+
61
+ <pre>
62
+ Spec::Runner.configure do |config|
63
+
64
+ config.before(:suite) do
65
+ DatabaseCleaner.strategy = :transaction
66
+ DatabaseCleaner.clean_with(:truncation)
67
+ end
68
+
69
+ config.before(:each) do
70
+ DatabaseCleaner.start
71
+ end
72
+
73
+ config.after(:each) do
74
+ DatabaseCleaner.clean
75
+ end
76
+
77
+ end
78
+ </pre>
79
+
59
80
  For use in Cucumber please see the section below.
60
81
 
61
82
 
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :minor: 1
3
- :patch: 2
2
+ :patch: 3
4
3
  :major: 0
4
+ :minor: 1
@@ -5,7 +5,3 @@ require 'spec/expectations'
5
5
 
6
6
  require 'test/unit/assertions'
7
7
 
8
- World do |world|
9
-
10
- world
11
- end
@@ -3,22 +3,29 @@ module ActiveRecord
3
3
  module ConnectionAdapters
4
4
  class MysqlAdapter
5
5
  def truncate_table(table_name)
6
- execute("TRUNCATE TABLE #{table_name};")
6
+ execute("TRUNCATE TABLE #{quote_table_name(table_name)};")
7
7
  end
8
8
  end
9
9
 
10
10
  class SQLite3Adapter
11
11
  def truncate_table(table_name)
12
- execute("DELETE FROM #{table_name};")
12
+ execute("DELETE FROM #{quote_table_name(table_name)};")
13
13
  end
14
14
  end
15
15
 
16
16
  class JdbcAdapter
17
17
  def truncate_table(table_name)
18
- execute("TRUNCATE TABLE #{table_name};")
18
+ execute("TRUNCATE TABLE #{quote_table_name(table_name)};")
19
19
  end
20
20
  end
21
21
 
22
+ class PostgreSQLAdapter
23
+ def truncate_table(table_name)
24
+ execute("TRUNCATE TABLE #{quote_table_name(table_name)};")
25
+ end
26
+ end
27
+
28
+
22
29
  end
23
30
 
24
31
  end
@@ -3,7 +3,7 @@ require 'database_cleaner/active_record/truncation'
3
3
  require 'active_record'
4
4
  module ActiveRecord
5
5
  module ConnectionAdapters
6
- [MysqlAdapter, SQLite3Adapter, JdbcAdapter].each do |adapter|
6
+ [MysqlAdapter, SQLite3Adapter, JdbcAdapter, PostgreSQLAdapter].each do |adapter|
7
7
  describe adapter, "#truncate_table" do
8
8
  it "should truncate the table"
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bmabey-database_cleaner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Mabey
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-05 00:00:00 -08:00
12
+ date: 2009-04-30 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -20,47 +20,36 @@ executables: []
20
20
  extensions: []
21
21
 
22
22
  extra_rdoc_files:
23
- - README.textile
24
23
  - LICENSE
24
+ - README.textile
25
25
  files:
26
+ - History.txt
26
27
  - README.textile
28
+ - Rakefile
27
29
  - VERSION.yml
28
- - examples/features
30
+ - cucumber.yml
29
31
  - examples/features/example.feature
30
- - examples/features/step_definitions
31
32
  - examples/features/step_definitions/example_steps.rb
32
- - examples/features/support
33
33
  - examples/features/support/env.rb
34
- - examples/lib
35
34
  - examples/lib/activerecord.rb
36
- - lib/database_cleaner
37
- - lib/database_cleaner/active_record
35
+ - features/cleaning.feature
36
+ - features/step_definitions/database_cleaner_steps.rb
37
+ - features/support/env.rb
38
+ - lib/database_cleaner.rb
38
39
  - lib/database_cleaner/active_record/transaction.rb
39
40
  - lib/database_cleaner/active_record/truncation.rb
40
41
  - lib/database_cleaner/configuration.rb
41
42
  - lib/database_cleaner/cucumber.rb
42
- - lib/database_cleaner/data_mapper
43
43
  - lib/database_cleaner/data_mapper/transaction.rb
44
- - lib/database_cleaner.rb
45
- - features/cleaning.feature
46
- - features/step_definitions
47
- - features/step_definitions/database_cleaner_steps.rb
48
- - features/support
49
- - features/support/env.rb
50
- - spec/database_cleaner
51
- - spec/database_cleaner/active_record
52
44
  - spec/database_cleaner/active_record/truncation_spec.rb
53
45
  - spec/database_cleaner/configuration_spec.rb
54
46
  - spec/spec.opts
55
47
  - spec/spec_helper.rb
56
- - Rakefile
57
- - cucumber.yml
58
48
  - LICENSE
59
49
  has_rdoc: true
60
50
  homepage: http://github.com/bmabey/database_cleaner
61
51
  post_install_message:
62
52
  rdoc_options:
63
- - --inline-source
64
53
  - --charset=UTF-8
65
54
  require_paths:
66
55
  - lib
@@ -81,7 +70,12 @@ requirements: []
81
70
  rubyforge_project:
82
71
  rubygems_version: 1.2.0
83
72
  signing_key:
84
- specification_version: 2
73
+ specification_version: 3
85
74
  summary: TODO
86
- test_files: []
87
-
75
+ test_files:
76
+ - spec/database_cleaner/active_record/truncation_spec.rb
77
+ - spec/database_cleaner/configuration_spec.rb
78
+ - spec/spec_helper.rb
79
+ - examples/features/step_definitions/example_steps.rb
80
+ - examples/features/support/env.rb
81
+ - examples/lib/activerecord.rb