Permalink
Browse files

Move all spec support files into spec/support

  • Loading branch information...
Carl Lerche
Carl Lerche committed Mar 12, 2010
1 parent e346123 commit 8db90ba95d4a240fde68127e806162b3e600c383
View
@@ -1,6 +1,6 @@
coverage/*
config/database.yml
-spec/fixtures/*database*
+spec/support/fixtures/*database*
*.DS_Store
debug.log
pkg
View
@@ -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
Binary file not shown.
View
@@ -7,44 +7,8 @@
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 @@ def check(*args)
# 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
View
@@ -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
@@ -4,7 +4,7 @@
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" => {
View
@@ -0,0 +1 @@
+require "support/doubles/hash"
File renamed without changes.
View
@@ -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
View
@@ -0,0 +1,3 @@
+require "support/matchers/be_like"
+require "support/matchers/disambiguate_attributes"
+require "support/matchers/hash_the_same_as"
File renamed without changes.
File renamed without changes.

0 comments on commit 8db90ba

Please sign in to comment.