adaptable_tests_for_rails 1.0.0 → 1.1.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.
@@ -6,15 +6,12 @@ module AdaptableTestsForRails
|
|
6
6
|
setup_test_environment( ENV['DB'] || 'test' )
|
7
7
|
end
|
8
8
|
|
9
|
-
config.before_initialize do
|
10
|
-
|
11
|
-
end
|
12
|
-
|
13
9
|
def setup_test_environment( env )
|
14
|
-
puts "", "Connecting to #{db_type( env )} database ..."
|
15
10
|
ActiveRecord::Base.establish_connection( Rails.configuration.database_configuration["test_#{env}"] )
|
16
11
|
puts building_database_statement, ""
|
17
|
-
|
12
|
+
silence_stream STDOUT do
|
13
|
+
load schema_path
|
14
|
+
end
|
18
15
|
end
|
19
16
|
|
20
17
|
def db_type( env )
|
data/rails/init.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
def setup_test_environment( env )
|
2
|
+
puts "", "Connecting to #{db_type( env )} database ..."
|
3
|
+
ActiveRecord::Base.establish_connection( Rails.configuration.database_configuration["test_#{env}"] )
|
4
|
+
puts building_database_statement, ""
|
5
|
+
load schema_path
|
6
|
+
end
|
7
|
+
|
8
|
+
def db_type( env )
|
9
|
+
env.gsub( /test_/, '' ).gsub( /_/, ' ' )
|
10
|
+
end
|
11
|
+
|
12
|
+
def building_database_statement
|
13
|
+
"Building database from db/schema.rb ..."
|
14
|
+
end
|
15
|
+
|
16
|
+
def schema_path
|
17
|
+
"#{Rails.root}/db/schema.rb"
|
18
|
+
end
|
19
|
+
|
20
|
+
if Rails.env.test?
|
21
|
+
setup_test_environment( ENV['DB'] || 'test' )
|
22
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adaptable_tests_for_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 1.0.0
|
10
|
+
version: 1.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- C. Jason Harrelson (midas)
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-09-17 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -40,6 +40,7 @@ files:
|
|
40
40
|
- lib/adaptable_tests_for_rails.rb
|
41
41
|
- lib/adaptable_tests_for_rails/railtie.rb
|
42
42
|
- lib/adaptable_tests_for_rails/version.rb
|
43
|
+
- rails/init.rb
|
43
44
|
has_rdoc: true
|
44
45
|
homepage: ""
|
45
46
|
licenses: []
|