db_leftovers 0.1.0 → 0.2.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.
data/Gemfile CHANGED
@@ -11,7 +11,7 @@ gem 'rails', '>= 3.0.0'
11
11
  # Add dependencies to develop your gem here.
12
12
  # Include everything needed to run rake, tests, features, etc.
13
13
  group :development do
14
- gem "shoulda", ">= 0"
14
+ gem "rspec", "~> 2.3.0"
15
15
  gem "bundler", "~> 1.0.0"
16
16
  gem "jeweler", "~> 1.6.4"
17
17
  gem "rcov", ">= 0"
data/Gemfile.lock CHANGED
@@ -31,6 +31,7 @@ GEM
31
31
  multi_json (~> 1.0)
32
32
  arel (2.2.1)
33
33
  builder (3.0.0)
34
+ diff-lcs (1.1.3)
34
35
  erubis (2.7.0)
35
36
  git (1.2.5)
36
37
  hike (1.2.1)
@@ -75,7 +76,14 @@ GEM
75
76
  rcov (0.9.11)
76
77
  rdoc (3.12)
77
78
  json (~> 1.4)
78
- shoulda (2.11.3)
79
+ rspec (2.3.0)
80
+ rspec-core (~> 2.3.0)
81
+ rspec-expectations (~> 2.3.0)
82
+ rspec-mocks (~> 2.3.0)
83
+ rspec-core (2.3.1)
84
+ rspec-expectations (2.3.0)
85
+ diff-lcs (~> 1.1.2)
86
+ rspec-mocks (2.3.0)
79
87
  sprockets (2.0.3)
80
88
  hike (~> 1.2)
81
89
  rack (~> 1.0)
@@ -95,4 +103,4 @@ DEPENDENCIES
95
103
  jeweler (~> 1.6.4)
96
104
  rails (>= 3.0.0)
97
105
  rcov
98
- shoulda
106
+ rspec (~> 2.3.0)
data/Rakefile CHANGED
@@ -29,24 +29,20 @@ Jeweler::Tasks.new do |gem|
29
29
  end
30
30
  Jeweler::RubygemsDotOrgTasks.new
31
31
 
32
- require 'rake/testtask'
33
- Rake::TestTask.new(:test) do |test|
34
- test.libs << 'lib' << 'test'
35
- test.pattern = 'test/**/test_*.rb'
36
- test.verbose = true
32
+ require 'rspec/core'
33
+ require 'rspec/core/rake_task'
34
+ RSpec::Core::RakeTask.new(:spec) do |spec|
35
+ spec.pattern = FileList['spec/**/*_spec.rb']
37
36
  end
38
37
 
39
- require 'rcov/rcovtask'
40
- Rcov::RcovTask.new do |test|
41
- test.libs << 'test'
42
- test.pattern = 'test/**/test_*.rb'
43
- test.verbose = true
44
- test.rcov_opts << '--exclude "gems/*"'
38
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
39
+ spec.pattern = 'spec/**/*_spec.rb'
40
+ spec.rcov = true
45
41
  end
46
42
 
47
- task :default => :test
43
+ task :default => :spec
48
44
 
49
- require 'rake/rdoctask'
45
+ require 'rdoc/task'
50
46
  Rake::RDocTask.new do |rdoc|
51
47
  version = File.exist?('VERSION') ? File.read('VERSION') : ""
52
48
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
data/db_leftovers.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "db_leftovers"
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Paul A. Jungwirth"]
@@ -28,8 +28,8 @@ Gem::Specification.new do |s|
28
28
  "lib/db_leftovers.rb",
29
29
  "lib/db_leftovers/dsl.rb",
30
30
  "lib/tasks/leftovers.rake",
31
- "test/helper.rb",
32
- "test/test_db_leftovers.rb"
31
+ "spec/db_leftovers_spec.rb",
32
+ "spec/spec_helper.rb"
33
33
  ]
34
34
  s.homepage = "http://github.com/pjungwir/db_leftovers"
35
35
  s.licenses = ["MIT"]
@@ -42,20 +42,20 @@ Gem::Specification.new do |s|
42
42
 
43
43
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
44
44
  s.add_runtime_dependency(%q<rails>, [">= 3.0.0"])
45
- s.add_development_dependency(%q<shoulda>, [">= 0"])
45
+ s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
46
46
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
47
47
  s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
48
48
  s.add_development_dependency(%q<rcov>, [">= 0"])
49
49
  else
50
50
  s.add_dependency(%q<rails>, [">= 3.0.0"])
51
- s.add_dependency(%q<shoulda>, [">= 0"])
51
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
52
52
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
53
53
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
54
54
  s.add_dependency(%q<rcov>, [">= 0"])
55
55
  end
56
56
  else
57
57
  s.add_dependency(%q<rails>, [">= 3.0.0"])
58
- s.add_dependency(%q<shoulda>, [">= 0"])
58
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
59
59
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
60
60
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
61
61
  s.add_dependency(%q<rcov>, [">= 0"])
@@ -29,11 +29,11 @@ module DBLeftovers
29
29
  opts.keys.each do |k|
30
30
  raise "Unknown option: #{k}" unless [:where, :unique, :name].include?(k)
31
31
  end
32
- @table_name = table_name
33
- @column_names = column_names
32
+ @table_name = table_name.to_s
33
+ @column_names = [column_names].flatten.map{|x| x.to_s}
34
34
  @where_clause = opts[:where]
35
35
  @unique = opts[:unique]
36
- @index_name = opts[:name] || choose_name(table_name, column_names)
36
+ @index_name = opts[:name] || choose_name(@table_name, @column_names)
37
37
  end
38
38
 
39
39
  def unique?
@@ -94,12 +94,13 @@ module DBLeftovers
94
94
 
95
95
  class DSL
96
96
  def initialize
97
+ @db = DatabaseInterface.new
97
98
  @indexes_by_table = {} # Set from the DSL
98
- @old_indexes = lookup_all_indexes
99
+ @old_indexes = @db.lookup_all_indexes
99
100
  @new_indexes = {}
100
101
 
101
102
  @foreign_keys_by_table = {} # Set from the DSL
102
- @old_foreign_keys = lookup_all_foreign_keys
103
+ @old_foreign_keys = @db.lookup_all_foreign_keys
103
104
  @new_foreign_keys = {}
104
105
  end
105
106
 
@@ -130,7 +131,7 @@ module DBLeftovers
130
131
  if index_exists?(idx)
131
132
  puts "Index already exists: #{idx.index_name} on #{idx.table_name}"
132
133
  else
133
- execute_add_index(idx)
134
+ @db.execute_add_index(idx)
134
135
  puts "Created index: #{idx.index_name} on #{idx.table_name}"
135
136
  end
136
137
  @new_indexes[truncate_index_name(idx.index_name)] = table_name
@@ -141,7 +142,7 @@ module DBLeftovers
141
142
  @old_indexes.each do |index_name, table_name|
142
143
  if not @new_indexes[index_name]
143
144
  # puts "#{index_name} #{table_name}"
144
- execute_drop_index(table_name, index_name)
145
+ @db.execute_drop_index(table_name, index_name)
145
146
  puts "Dropped index: #{index_name} on #{table_name}"
146
147
  end
147
148
  end
@@ -154,7 +155,7 @@ module DBLeftovers
154
155
  if foreign_key_exists?(fk)
155
156
  puts "Foreign Key already exists: #{fk.constraint_name} on #{fk.from_table}"
156
157
  else
157
- execute_add_foreign_key(fk)
158
+ @db.execute_add_foreign_key(fk)
158
159
  puts "Created foreign key: #{fk.constraint_name} on #{fk.from_table}"
159
160
  end
160
161
  @new_foreign_keys[fk.constraint_name] = fk
@@ -164,7 +165,7 @@ module DBLeftovers
164
165
  # Now drop any old foreign keys that are no longer in the definition file:
165
166
  @old_foreign_keys.each do |constraint_name, fk|
166
167
  if not @new_foreign_keys[constraint_name]
167
- execute_drop_foreign_key(fk.from_table, fk.from_column)
168
+ @db.execute_drop_foreign_key(constraint_name, fk.from_table, fk.from_column)
168
169
  puts "Dropped foreign key: #{constraint_name} on #{fk.from_table}"
169
170
  end
170
171
  end
@@ -182,6 +183,26 @@ module DBLeftovers
182
183
  t << fk
183
184
  end
184
185
 
186
+ def truncate_index_name(index_name)
187
+ index_name[0,63]
188
+ end
189
+
190
+ def index_exists?(idx)
191
+ @old_indexes[truncate_index_name(idx.index_name)]
192
+ end
193
+
194
+ def foreign_key_exists?(fk)
195
+ @old_foreign_keys[fk.constraint_name]
196
+ end
197
+
198
+ def name_constraint(from_table, from_column)
199
+ "fk_#{from_table}_#{from_column}"
200
+ end
201
+
202
+ end
203
+
204
+ class DatabaseInterface
205
+
185
206
  def lookup_all_indexes
186
207
  ret = {}
187
208
  sql = <<-EOQ
@@ -224,18 +245,6 @@ module DBLeftovers
224
245
  return ret
225
246
  end
226
247
 
227
- def truncate_index_name(index_name)
228
- index_name[0,63]
229
- end
230
-
231
- def index_exists?(idx)
232
- @old_indexes[truncate_index_name(idx.index_name)]
233
- end
234
-
235
- def foreign_key_exists?(fk)
236
- @old_foreign_keys[fk.constraint_name]
237
- end
238
-
239
248
  def execute_add_index(idx)
240
249
  unique = idx.unique? ? 'UNIQUE' : ''
241
250
  where = idx.where_clause.present? ? "WHERE #{idx.where_clause}" : ''
@@ -246,34 +255,33 @@ module DBLeftovers
246
255
  (#{idx.column_names.join(', ')})
247
256
  #{where}
248
257
  EOQ
249
- ActiveRecord::Base.connection.execute(sql)
258
+ execute_sql(sql)
250
259
  end
251
260
 
252
261
  def execute_drop_index(table_name, index_name)
253
262
  sql = <<-EOQ
254
263
  DROP INDEX #{index_name}
255
264
  EOQ
256
- ActiveRecord::Base.connection.execute(sql)
265
+ execute_sql(sql)
257
266
  end
258
267
 
259
268
  def execute_add_foreign_key(fk)
260
269
  on_delete = "ON DELETE CASCADE" if fk.cascade
261
270
  on_delete = "ON DELETE SET NULL" if fk.set_null
262
- ActiveRecord::Base.connection.execute %{ALTER TABLE #{fk.from_table}
271
+ execute_sql %{ALTER TABLE #{fk.from_table}
263
272
  ADD CONSTRAINT #{fk.constraint_name}
264
273
  FOREIGN KEY (#{fk.from_column})
265
274
  REFERENCES #{fk.to_table} (#{fk.to_column})
266
275
  #{on_delete}}
267
276
  end
268
277
 
269
- def execute_drop_foreign_key(from_table, from_column)
270
- constraint_name = name_constraint(from_table, from_column)
271
- ActiveRecord::Base.connection.execute %{ALTER TABLE #{from_table}
278
+ def execute_drop_foreign_key(constraint_name, from_table, from_column)
279
+ execute_sql %{ALTER TABLE #{from_table}
272
280
  DROP CONSTRAINT #{constraint_name}}
273
281
  end
274
282
 
275
- def name_constraint(from_table, from_column)
276
- "fk_#{from_table}_#{from_column}"
283
+ def execute_sql(sql)
284
+ ActiveRecord::Base.connection.execute(sql)
277
285
  end
278
286
 
279
287
  end
@@ -0,0 +1,176 @@
1
+ require 'rails'
2
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
3
+
4
+ DBLeftovers::DatabaseInterface.class_eval do
5
+
6
+ def initialize
7
+ @@sqls = []
8
+ end
9
+
10
+ def self.sqls
11
+ @@sqls
12
+ end
13
+
14
+ def execute_sql(sql)
15
+ @@sqls << sql
16
+ end
17
+
18
+ def self.saw_sql(sql)
19
+ # puts sqls.join("\n\n\n")
20
+ # Don't fail if only the whitespace is different:
21
+ sqls.map{|x| x.gsub(/\s+/m, ' ').strip}.include?(
22
+ sql.gsub(/\s+/m, ' ').strip
23
+ )
24
+ end
25
+
26
+ def self.starts_with(indexes, foreign_keys)
27
+ # Convert symbols to strings:
28
+ @@indexes = indexes.inject({}) do |h, (k, v)| h[k.to_s] = v; h end
29
+ @@foreign_keys = foreign_keys.inject({}) do |h, (k, v)| h[k.to_s] = v; h end
30
+ end
31
+
32
+ def lookup_all_indexes
33
+ @@indexes
34
+ end
35
+
36
+ def lookup_all_foreign_keys
37
+ @@foreign_keys
38
+ end
39
+
40
+ end
41
+
42
+ RSpec::Matchers.define :have_seen_sql do |sql|
43
+ match do |db|
44
+ db.saw_sql(sql)
45
+ end
46
+
47
+ failure_message_for_should do |db|
48
+ "Should have seen...\n#{sql}\n...but instead saw...\n#{db.sqls.join("\n.....\n")}"
49
+ end
50
+ end
51
+
52
+ describe DBLeftovers do
53
+
54
+ it "should allow an empty definition" do
55
+ DBLeftovers::DatabaseInterface.starts_with({}, {})
56
+ DBLeftovers::Definition.define do
57
+ end
58
+ DBLeftovers::DatabaseInterface.sqls.should be_empty
59
+ end
60
+
61
+ it "should create indexes on an empty database" do
62
+ DBLeftovers::DatabaseInterface.starts_with({}, {})
63
+ DBLeftovers::Definition.define do
64
+ index :books, :shelf_id
65
+ index :books, :publisher_id, :where => 'published'
66
+ end
67
+ DBLeftovers::DatabaseInterface.sqls.size.should == 2
68
+ DBLeftovers::DatabaseInterface.should have_seen_sql <<-EOQ
69
+ CREATE INDEX index_books_on_shelf_id
70
+ ON books
71
+ (shelf_id)
72
+ EOQ
73
+ DBLeftovers::DatabaseInterface.should have_seen_sql <<-EOQ
74
+ CREATE INDEX index_books_on_publisher_id
75
+ ON books
76
+ (publisher_id)
77
+ WHERE published
78
+ EOQ
79
+ end
80
+
81
+ it "should create foreign keys on an empty database" do
82
+ DBLeftovers::DatabaseInterface.starts_with({}, {})
83
+ DBLeftovers::Definition.define do
84
+ foreign_key :books, :shelf_id, :shelves
85
+ foreign_key :books, :publisher_id, :publishers, :id, :set_null => true
86
+ foreign_key :books, :author_id, :authors, :id, :cascade => true
87
+ end
88
+ DBLeftovers::DatabaseInterface.sqls.should have(3).items
89
+ DBLeftovers::DatabaseInterface.should have_seen_sql <<-EOQ
90
+ ALTER TABLE books
91
+ ADD CONSTRAINT fk_books_shelf_id
92
+ FOREIGN KEY (shelf_id)
93
+ REFERENCES shelves (id)
94
+ EOQ
95
+ DBLeftovers::DatabaseInterface.should have_seen_sql <<-EOQ
96
+ ALTER TABLE books
97
+ ADD CONSTRAINT fk_books_publisher_id
98
+ FOREIGN KEY (publisher_id)
99
+ REFERENCES publishers (id)
100
+ ON DELETE SET NULL
101
+ EOQ
102
+ DBLeftovers::DatabaseInterface.should have_seen_sql <<-EOQ
103
+ ALTER TABLE books
104
+ ADD CONSTRAINT fk_books_author_id
105
+ FOREIGN KEY (author_id)
106
+ REFERENCES authors (id)
107
+ ON DELETE CASCADE
108
+ EOQ
109
+ end
110
+
111
+
112
+
113
+ it "should not create indexes when they already exist" do
114
+ DBLeftovers::DatabaseInterface.starts_with({
115
+ :index_books_on_shelf_id => DBLeftovers::Index.new(:books, :index_id),
116
+ :index_books_on_publisher_id => DBLeftovers::Index.new(
117
+ :books, :publisher_id, :where => 'published')
118
+ }, {})
119
+ DBLeftovers::Definition.define do
120
+ index :books, :shelf_id
121
+ index :books, :publisher_id, :where => 'published'
122
+ end
123
+ DBLeftovers::DatabaseInterface.sqls.should have(0).items
124
+ end
125
+
126
+
127
+
128
+
129
+ it "should not create foreign keys when they already exist" do
130
+ DBLeftovers::DatabaseInterface.starts_with({}, {
131
+ :fk_books_shelf_id => DBLeftovers::ForeignKey.new('fk_books_shelf_id',
132
+ 'books', 'shelf_id', 'shelves', 'id')
133
+ })
134
+ DBLeftovers::Definition.define do
135
+ foreign_key :books, :shelf_id, :shelves
136
+ end
137
+ DBLeftovers::DatabaseInterface.sqls.should have(0).items
138
+ end
139
+
140
+
141
+
142
+ it "should drop indexes when they are removed from the definition" do
143
+ DBLeftovers::DatabaseInterface.starts_with({
144
+ :index_books_on_shelf_id => DBLeftovers::Index.new(:books, :index_id),
145
+ :index_books_on_publisher_id => DBLeftovers::Index.new(
146
+ :books, :publisher_id, :where => 'published')
147
+ }, {})
148
+ DBLeftovers::Definition.define do
149
+ index :books, :shelf_id
150
+ end
151
+ DBLeftovers::DatabaseInterface.sqls.should have(1).item
152
+ DBLeftovers::DatabaseInterface.should have_seen_sql <<-EOQ
153
+ DROP INDEX index_books_on_publisher_id
154
+ EOQ
155
+ end
156
+
157
+
158
+
159
+ it "should drop foreign keys when they are removed from the definition" do
160
+ DBLeftovers::DatabaseInterface.starts_with({}, {
161
+ :fk_books_shelf_id => DBLeftovers::ForeignKey.new('fk_books_shelf_id',
162
+ 'books', 'shelf_id', 'shelves', 'id'),
163
+ :fk_books_author_id => DBLeftovers::ForeignKey.new('fk_books_author_id',
164
+ 'books', 'author_id', 'authors', 'id')
165
+ })
166
+ DBLeftovers::Definition.define do
167
+ foreign_key :books, :shelf_id, :shelves
168
+ end
169
+ DBLeftovers::DatabaseInterface.sqls.should have(1).item
170
+ DBLeftovers::DatabaseInterface.should have_seen_sql <<-EOQ
171
+ ALTER TABLE books DROP CONSTRAINT fk_books_author_id
172
+ EOQ
173
+ end
174
+
175
+
176
+ end
@@ -0,0 +1,13 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'rspec/matchers'
5
+ require 'db_leftovers'
6
+
7
+ # Requires supporting files with custom matchers and macros, etc.,
8
+ # in ./support/ and its subdirectories.
9
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
10
+
11
+ RSpec.configure do |config|
12
+
13
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: db_leftovers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-01-17 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &76729710 !ruby/object:Gem::Requirement
16
+ requirement: &86541750 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,21 +21,21 @@ dependencies:
21
21
  version: 3.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *76729710
24
+ version_requirements: *86541750
25
25
  - !ruby/object:Gem::Dependency
26
- name: shoulda
27
- requirement: &76729080 !ruby/object:Gem::Requirement
26
+ name: rspec
27
+ requirement: &86541450 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
- - - ! '>='
30
+ - - ~>
31
31
  - !ruby/object:Gem::Version
32
- version: '0'
32
+ version: 2.3.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *76729080
35
+ version_requirements: *86541450
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &76615000 !ruby/object:Gem::Requirement
38
+ requirement: &86541140 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.0.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *76615000
46
+ version_requirements: *86541140
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jeweler
49
- requirement: &76614690 !ruby/object:Gem::Requirement
49
+ requirement: &86540780 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.6.4
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *76614690
57
+ version_requirements: *86540780
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rcov
60
- requirement: &76614430 !ruby/object:Gem::Requirement
60
+ requirement: &86540450 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *76614430
68
+ version_requirements: *86540450
69
69
  description: ! " Define indexes and foreign keys for your Rails app\n in
70
70
  one place using an easy-to-read DSL,\n then run a rake task to bring your
71
71
  database up-to-date.\n"
@@ -87,8 +87,8 @@ files:
87
87
  - lib/db_leftovers.rb
88
88
  - lib/db_leftovers/dsl.rb
89
89
  - lib/tasks/leftovers.rake
90
- - test/helper.rb
91
- - test/test_db_leftovers.rb
90
+ - spec/db_leftovers_spec.rb
91
+ - spec/spec_helper.rb
92
92
  homepage: http://github.com/pjungwir/db_leftovers
93
93
  licenses:
94
94
  - MIT
@@ -104,7 +104,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
104
104
  version: '0'
105
105
  segments:
106
106
  - 0
107
- hash: -340944739
107
+ hash: 347591153
108
108
  required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  none: false
110
110
  requirements:
data/test/helper.rb DELETED
@@ -1,18 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
10
- require 'test/unit'
11
- require 'shoulda'
12
-
13
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
- $LOAD_PATH.unshift(File.dirname(__FILE__))
15
- require 'db_leftovers'
16
-
17
- class Test::Unit::TestCase
18
- end
@@ -1,7 +0,0 @@
1
- require 'helper'
2
-
3
- class TestDbLeftovers < Test::Unit::TestCase
4
- should "probably rename this file and start testing for real" do
5
- flunk "hey buddy, you should probably rename this file and start testing for real"
6
- end
7
- end