imedo-dry_plugin_test_helper 0.0.7 → 0.0.8
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.
@@ -7,7 +7,12 @@ class PluginTestEnvironment
|
|
7
7
|
# initializes the test environment
|
8
8
|
#
|
9
9
|
#
|
10
|
-
def self.initialize_environment(plugin_dir, options = {
|
10
|
+
def self.initialize_environment(plugin_dir, options = {})
|
11
|
+
default_options = {
|
12
|
+
:use_standard_migration => true
|
13
|
+
}
|
14
|
+
options = default_options.merge(options)
|
15
|
+
|
11
16
|
if plugin_dir.nil?
|
12
17
|
plugin_dir ||= find_plugin_dir_by_caller
|
13
18
|
else
|
@@ -28,13 +33,9 @@ class PluginTestEnvironment
|
|
28
33
|
config.cache_classes = false
|
29
34
|
config.whiny_nils = true
|
30
35
|
|
31
|
-
config.load_paths << "#{File.dirname(__FILE__)}/../../../lib/"
|
32
|
-
|
33
36
|
yield config if block_given?
|
34
37
|
end
|
35
38
|
|
36
|
-
require rails_root_dir(options[:rails_version]) + '/config/environment.rb'
|
37
|
-
|
38
39
|
Test::Unit::TestCase.class_eval do
|
39
40
|
cattr_accessor :rails_root
|
40
41
|
self.rails_root = PluginTestEnvironment.plugin_path
|
@@ -46,10 +47,14 @@ class PluginTestEnvironment
|
|
46
47
|
plugin_migration
|
47
48
|
end
|
48
49
|
|
50
|
+
def self.rails_dir(rails_version)
|
51
|
+
File.join(test_helper_base_dir, "#{rails_version || latest_rails_version}/")
|
52
|
+
end
|
53
|
+
|
49
54
|
def self.rails_root_dir(rails_version)
|
50
|
-
|
51
|
-
init_environment(rails_version || latest_rails_version) unless File.exists?(
|
52
|
-
|
55
|
+
target_directory = rails_dir(rails_version)
|
56
|
+
init_environment(rails_version || latest_rails_version) unless File.exists?(target_directory)
|
57
|
+
target_directory
|
53
58
|
end
|
54
59
|
|
55
60
|
def self.test_helper_base_dir
|
@@ -61,10 +66,12 @@ class PluginTestEnvironment
|
|
61
66
|
end
|
62
67
|
|
63
68
|
def self.init_environment(rails_version)
|
64
|
-
target_directory =
|
69
|
+
target_directory = rails_dir(rails_version)
|
65
70
|
FileUtils.mkdir_p target_directory
|
66
71
|
system("rails _#{rails_version}_ #{File.expand_path(target_directory)}")
|
72
|
+
FileUtils.rm target_directory + '/app/helpers/application_helper.rb'
|
67
73
|
FileUtils.cp_r File.dirname(__FILE__) + '/../rails_root_fixtures/app/models', target_directory + '/app'
|
74
|
+
FileUtils.cp_r File.dirname(__FILE__) + '/../rails_root_fixtures/app/controllers', target_directory + '/app'
|
68
75
|
FileUtils.cp_r File.dirname(__FILE__) + '/../rails_root_fixtures/db/migrate', target_directory + '/db'
|
69
76
|
FileUtils.cp_r File.dirname(__FILE__) + '/../rails_root_fixtures/vendor/plugins/plugin_to_test', target_directory + '/vendor/plugins/'
|
70
77
|
FileUtils.cp File.dirname(__FILE__) + '/../rails_root_fixtures/config/database.yml', target_directory + '/config/database.yml'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imedo-dry_plugin_test_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hendrik Volkmer
|
@@ -9,7 +9,7 @@ autorequire: active_record
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-05-
|
12
|
+
date: 2009-05-15 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -35,6 +35,8 @@ files:
|
|
35
35
|
- lib/plugin_test_environment.rb
|
36
36
|
- lib/silent_logger.rb
|
37
37
|
- rails_root_fixtures/app
|
38
|
+
- rails_root_fixtures/app/controllers
|
39
|
+
- rails_root_fixtures/app/controllers/application.rb
|
38
40
|
- rails_root_fixtures/app/models
|
39
41
|
- rails_root_fixtures/app/models/article.rb
|
40
42
|
- rails_root_fixtures/app/models/author.rb
|