diff options
author | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-11-06 17:21:39 -0800 |
---|---|---|
committer | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-11-11 18:09:16 -0800 |
commit | 82b9b151ffde44305d67744c0bfd9bb5505f6fbe (patch) | |
tree | a30f92f7d438e2fede751509d4772957cdefeda9 /railties/test/isolation | |
parent | fca32eb6c5b41e4f19a25b7b246c4a8a3d763667 (diff) | |
download | rails-82b9b151ffde44305d67744c0bfd9bb5505f6fbe.tar.gz rails-82b9b151ffde44305d67744c0bfd9bb5505f6fbe.tar.bz2 rails-82b9b151ffde44305d67744c0bfd9bb5505f6fbe.zip |
Refactor plugins
Diffstat (limited to 'railties/test/isolation')
-rw-r--r-- | railties/test/isolation/abstract_unit.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb index 0b479e944c..145d16b6d9 100644 --- a/railties/test/isolation/abstract_unit.rb +++ b/railties/test/isolation/abstract_unit.rb @@ -92,6 +92,34 @@ module TestHelpers add_to_config 'config.action_controller.session = { :key => "_myapp_session", :secret => "bac838a849c1d5c4de2e6a50af826079" }' end + class Bukkit + def initialize(path) + @path = path + end + + def write(file, string) + path = "#{@path}/#{file}" + FileUtils.mkdir_p(File.dirname(path)) + File.open(path, "w") {|f| f.puts string } + end + + def delete(file) + File.delete("#{@path}/#{file}") + end + end + + def plugin(name, string = "") + dir = "#{app_path}/vendor/plugins/#{name}" + FileUtils.mkdir_p(dir) + File.open("#{dir}/init.rb", 'w') do |f| + f.puts "::#{name.upcase} = 'loaded'" + f.puts string + end + Bukkit.new(dir).tap do |bukkit| + yield bukkit if block_given? + end + end + def script(script) Dir.chdir(app_path) do `#{Gem.ruby} #{app_path}/script/#{script}` |