aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2010-03-11 17:08:55 -0800
committerCarl Lerche <carllerche@mac.com>2010-03-11 17:10:40 -0800
commit8db90ba95d4a240fde68127e806162b3e600c383 (patch)
tree9b4ecaeb523e53c1f86cf3cb654e71de945c4e83
parente3461239adfa972de8f25a2bc6b48b4a8aa62c9c (diff)
downloadrails-8db90ba95d4a240fde68127e806162b3e600c383.tar.gz
rails-8db90ba95d4a240fde68127e806162b3e600c383.tar.bz2
rails-8db90ba95d4a240fde68127e806162b3e600c383.zip
Move all spec support files into spec/support
-rw-r--r--.gitignore2
-rw-r--r--Rakefile4
-rw-r--r--spec/spec/fixtures/fixture_database.sqlite3bin0 -> 4096 bytes
-rw-r--r--spec/spec_helper.rb44
-rw-r--r--spec/support/check.rb6
-rw-r--r--spec/support/connections/mysql_connection.rb (renamed from spec/connections/mysql_connection.rb)0
-rw-r--r--spec/support/connections/oracle_connection.rb (renamed from spec/connections/oracle_connection.rb)0
-rw-r--r--spec/support/connections/postgresql_connection.rb (renamed from spec/connections/postgresql_connection.rb)0
-rw-r--r--spec/support/connections/sqlite3_connection.rb (renamed from spec/connections/sqlite3_connection.rb)2
-rw-r--r--spec/support/doubles.rb1
-rw-r--r--spec/support/doubles/hash.rb (renamed from spec/doubles/hash.rb)0
-rw-r--r--spec/support/guards.rb28
-rw-r--r--spec/support/matchers.rb3
-rw-r--r--spec/support/matchers/be_like.rb (renamed from spec/matchers/be_like.rb)0
-rw-r--r--spec/support/matchers/disambiguate_attributes.rb (renamed from spec/matchers/disambiguate_attributes.rb)0
-rw-r--r--spec/support/matchers/hash_the_same_as.rb (renamed from spec/matchers/hash_the_same_as.rb)0
-rw-r--r--spec/support/schemas/mysql_schema.rb (renamed from spec/schemas/mysql_schema.rb)0
-rw-r--r--spec/support/schemas/oracle_schema.rb (renamed from spec/schemas/oracle_schema.rb)0
-rw-r--r--spec/support/schemas/postgresql_schema.rb (renamed from spec/schemas/postgresql_schema.rb)0
-rw-r--r--spec/support/schemas/sqlite3_schema.rb (renamed from spec/schemas/sqlite3_schema.rb)0
20 files changed, 46 insertions, 44 deletions
diff --git a/.gitignore b/.gitignore
index 39cbb3948b..3fec2d912b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,6 @@
coverage/*
config/database.yml
-spec/fixtures/*database*
+spec/support/fixtures/*database*
*.DS_Store
debug.log
pkg
diff --git a/Rakefile b/Rakefile
index a1384196a2..ef633c0042 100644
--- a/Rakefile
+++ b/Rakefile
@@ -28,8 +28,8 @@ else
t.libs << "#{File.dirname(__FILE__)}/spec"
# t.warning = true
t.spec_files =
- ["spec/connections/#{adapter}_connection.rb"] +
- ["spec/schemas/#{adapter}_schema.rb"] +
+ ["spec/support/connections/#{adapter}_connection.rb"] +
+ ["spec/support/schemas/#{adapter}_schema.rb"] +
FileList['spec/**/*_spec.rb']
end
end
diff --git a/spec/spec/fixtures/fixture_database.sqlite3 b/spec/spec/fixtures/fixture_database.sqlite3
new file mode 100644
index 0000000000..cb52aacf7e
--- /dev/null
+++ b/spec/spec/fixtures/fixture_database.sqlite3
Binary files differ
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index b210af5ab4..894e70c29d 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -7,44 +7,8 @@ require 'pp'
require 'fileutils'
require 'arel'
-[:matchers, :doubles].each do |helper|
- Dir["#{dir}/#{helper}/*"].each { |m| require "#{dir}/#{helper}/#{File.basename(m)}" }
-end
-
-module AdapterGuards
- def adapter_is(*names)
- names = names.map(&:to_s)
- names.each{|name| verify_adapter_name(name)}
- yield if names.include? adapter_name
- end
-
- def adapter_is_not(*names)
- names = names.map(&:to_s)
- names.each{|name| verify_adapter_name(name)}
- yield unless names.include? adapter_name
- end
-
- def adapter_name
- name = ActiveRecord::Base.configurations["unit"][:adapter]
- name = 'oracle' if name == 'oracle_enhanced'
- verify_adapter_name(name)
- name
- end
-
- def verify_adapter_name(name)
- raise "Invalid adapter name: #{name}" unless valid_adapters.include?(name.to_s)
- end
-
- def valid_adapters
- %w[mysql postgresql sqlite3 oracle]
- end
-end
-
-module Check
- # This is used to eliminate Ruby warnings on some RSpec assertion lines
- # See: https://rspec.lighthouseapp.com/projects/5645/tickets/504
- def check(*args)
- end
+Dir["#{dir}/support/*.rb"].each do |file|
+ require file
end
Spec::Runner.configure do |config|
@@ -59,6 +23,6 @@ end
# load corresponding adapter using ADAPTER environment variable when running single *_spec.rb file
if adapter = ENV['ADAPTER']
- require "#{dir}/connections/#{adapter}_connection.rb"
- require "#{dir}/schemas/#{adapter}_schema.rb"
+ require "#{dir}/support/connections/#{adapter}_connection.rb"
+ require "#{dir}/support/schemas/#{adapter}_schema.rb"
end
diff --git a/spec/support/check.rb b/spec/support/check.rb
new file mode 100644
index 0000000000..0a89349629
--- /dev/null
+++ b/spec/support/check.rb
@@ -0,0 +1,6 @@
+module Check
+ # This is used to eliminate Ruby warnings on some RSpec assertion lines
+ # See: https://rspec.lighthouseapp.com/projects/5645/tickets/504
+ def check(*args)
+ end
+end \ No newline at end of file
diff --git a/spec/connections/mysql_connection.rb b/spec/support/connections/mysql_connection.rb
index 66a53b5037..66a53b5037 100644
--- a/spec/connections/mysql_connection.rb
+++ b/spec/support/connections/mysql_connection.rb
diff --git a/spec/connections/oracle_connection.rb b/spec/support/connections/oracle_connection.rb
index 05be04e410..05be04e410 100644
--- a/spec/connections/oracle_connection.rb
+++ b/spec/support/connections/oracle_connection.rb
diff --git a/spec/connections/postgresql_connection.rb b/spec/support/connections/postgresql_connection.rb
index 0fb6dfe065..0fb6dfe065 100644
--- a/spec/connections/postgresql_connection.rb
+++ b/spec/support/connections/postgresql_connection.rb
diff --git a/spec/connections/sqlite3_connection.rb b/spec/support/connections/sqlite3_connection.rb
index e8eeee17d0..abdbd24fe4 100644
--- a/spec/connections/sqlite3_connection.rb
+++ b/spec/support/connections/sqlite3_connection.rb
@@ -4,7 +4,7 @@ require 'logger'
ActiveRecord::Base.logger = Logger.new("debug.log")
-db_file = "spec/fixtures/fixture_database.sqlite3"
+db_file = "spec/support/fixtures/fixture_database.sqlite3"
ActiveRecord::Base.configurations = {
"unit" => {
diff --git a/spec/support/doubles.rb b/spec/support/doubles.rb
new file mode 100644
index 0000000000..212859cbd6
--- /dev/null
+++ b/spec/support/doubles.rb
@@ -0,0 +1 @@
+require "support/doubles/hash" \ No newline at end of file
diff --git a/spec/doubles/hash.rb b/spec/support/doubles/hash.rb
index fd9edd34ad..fd9edd34ad 100644
--- a/spec/doubles/hash.rb
+++ b/spec/support/doubles/hash.rb
diff --git a/spec/support/guards.rb b/spec/support/guards.rb
new file mode 100644
index 0000000000..cfa4b7b79a
--- /dev/null
+++ b/spec/support/guards.rb
@@ -0,0 +1,28 @@
+module AdapterGuards
+ def adapter_is(*names)
+ names = names.map(&:to_s)
+ names.each{|name| verify_adapter_name(name)}
+ yield if names.include? adapter_name
+ end
+
+ def adapter_is_not(*names)
+ names = names.map(&:to_s)
+ names.each{|name| verify_adapter_name(name)}
+ yield unless names.include? adapter_name
+ end
+
+ def adapter_name
+ name = ActiveRecord::Base.configurations["unit"][:adapter]
+ name = 'oracle' if name == 'oracle_enhanced'
+ verify_adapter_name(name)
+ name
+ end
+
+ def verify_adapter_name(name)
+ raise "Invalid adapter name: #{name}" unless valid_adapters.include?(name.to_s)
+ end
+
+ def valid_adapters
+ %w[mysql postgresql sqlite3 oracle]
+ end
+end \ No newline at end of file
diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb
new file mode 100644
index 0000000000..6f50d6cbc7
--- /dev/null
+++ b/spec/support/matchers.rb
@@ -0,0 +1,3 @@
+require "support/matchers/be_like"
+require "support/matchers/disambiguate_attributes"
+require "support/matchers/hash_the_same_as" \ No newline at end of file
diff --git a/spec/matchers/be_like.rb b/spec/support/matchers/be_like.rb
index c9d4d4b979..c9d4d4b979 100644
--- a/spec/matchers/be_like.rb
+++ b/spec/support/matchers/be_like.rb
diff --git a/spec/matchers/disambiguate_attributes.rb b/spec/support/matchers/disambiguate_attributes.rb
index bc4a5215d4..bc4a5215d4 100644
--- a/spec/matchers/disambiguate_attributes.rb
+++ b/spec/support/matchers/disambiguate_attributes.rb
diff --git a/spec/matchers/hash_the_same_as.rb b/spec/support/matchers/hash_the_same_as.rb
index 03e955a0cb..03e955a0cb 100644
--- a/spec/matchers/hash_the_same_as.rb
+++ b/spec/support/matchers/hash_the_same_as.rb
diff --git a/spec/schemas/mysql_schema.rb b/spec/support/schemas/mysql_schema.rb
index a2e913d756..a2e913d756 100644
--- a/spec/schemas/mysql_schema.rb
+++ b/spec/support/schemas/mysql_schema.rb
diff --git a/spec/schemas/oracle_schema.rb b/spec/support/schemas/oracle_schema.rb
index c8207c8d98..c8207c8d98 100644
--- a/spec/schemas/oracle_schema.rb
+++ b/spec/support/schemas/oracle_schema.rb
diff --git a/spec/schemas/postgresql_schema.rb b/spec/support/schemas/postgresql_schema.rb
index 23a48f5ad8..23a48f5ad8 100644
--- a/spec/schemas/postgresql_schema.rb
+++ b/spec/support/schemas/postgresql_schema.rb
diff --git a/spec/schemas/sqlite3_schema.rb b/spec/support/schemas/sqlite3_schema.rb
index c1fed70859..c1fed70859 100644
--- a/spec/schemas/sqlite3_schema.rb
+++ b/spec/support/schemas/sqlite3_schema.rb