Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Removed Deprecated Message #1

Closed
wants to merge 1 commit into from

1 participant

Duke
Duke

Removed Deprecated Message and duplicated run

Duke dukex closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 3, 2011
  1. removed deprecated message

    Emerson Vinicius authored
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 64 deletions.
  1. +10 −10 lib/blue_ridge.rb
  2. +0 −54 tasks/javascript_testing_tasks.rake
20 lib/blue_ridge.rb
View
@@ -1,18 +1,18 @@
module BlueRidge
JavaScriptSpecDirs = ["examples/javascripts", "spec/javascripts", "test/javascript"]
-
+
def self.plugin_prefix
- ENV["BLUE_RIDGE_PREFIX"] || "#{RAILS_ROOT}/vendor/plugins/blue-ridge"
+ ENV["BLUE_RIDGE_PREFIX"] || "#{::Rails.root.to_s}/vendor/plugins/blue-ridge"
end
-
+
def self.rhino_command
"java -Dblue.ridge.prefix=\"#{plugin_prefix}\" -jar #{plugin_prefix}/vendor/env-js.jar -w -debug"
end
-
+
def self.test_runner_command
"#{rhino_command} #{plugin_prefix}/lib/test_runner.js"
end
-
+
def self.find_base_spec_dir
return "examples" if File.exist?("examples")
return "spec" if File.exist?("spec")
@@ -24,25 +24,25 @@ def self.javascript_spec_dir
return "test/javascript" if base_spec_dir == "test"
base_spec_dir + "/javascripts"
end
-
+
def self.find_javascript_spec_dir
JavaScriptSpecDirs.find {|d| File.exist?(d) }
end
-
+
def self.find_specs_under_current_dir
Dir.glob("**/*_spec.js")
end
-
+
def self.run_spec(spec_filename)
system("#{test_runner_command} #{spec_filename}")
end
-
+
def self.run_specs_in_dir(spec_dir, spec_name = nil)
result = nil
Dir.chdir(spec_dir) { result = run_specs(spec_name) }
result
end
-
+
def self.run_specs(spec_name = nil)
specs = spec_name.nil? ? find_specs_under_current_dir : ["#{spec_name}_spec.js"]
all_fine = specs.inject(true) {|result, spec| result &= run_spec(spec) }
54 tasks/javascript_testing_tasks.rake
View
@@ -1,54 +0,0 @@
-require File.expand_path(File.dirname(__FILE__) + '/../lib/blue_ridge')
-
-def error_message_for_missing_spec_dir
- %Q{Could not find JavaScript test directory.
-None of the following directories existed: #{BlueRidge::JavaScriptSpecDirs.join(", ")}.
-Maybe you need to call './script/generate blue_ridge'?
-}
-end
-
-# Support Test::Unit & Test/Spec style
-namespace :test do
- desc "Runs all the JavaScript tests and outputs the results."
- task :javascripts do
- js_spec_dir = BlueRidge.find_javascript_spec_dir || (raise error_message_for_missing_spec_dir)
- raise "JavaScript test failures" unless BlueRidge.run_specs_in_dir(js_spec_dir, ENV["TEST"])
- end
-
- task :javascript => :javascripts
-end
-
-# Support RSpec style
-namespace :spec do
- task :javascripts => "test:javascripts"
- task :javascript => "test:javascripts"
-end
-
-# Support Micronaut style
-namespace :examples do
- task :javascripts => "test:javascripts"
- task :javascript => "test:javascripts"
-end
-
-
-namespace :js do
- desc "Open the JavaScript fixtures to ease running in-browser tests."
- task :fixtures do
- js_spec_dir = BlueRidge.find_javascript_spec_dir || (raise error_message_for_missing_spec_dir)
- fixture_dir = "#{js_spec_dir}/fixtures"
-
- if PLATFORM[/darwin/]
- system("open #{fixture_dir}")
- elsif PLATFORM[/linux/]
- system("firefox #{fixture_dir}")
- else
- puts "You can run your in-browser fixtures from #{fixture_dir}."
- end
- end
-
- desc "Runs the Rhino JavaScript shell."
- task :shell do
- rlwrap = `which rlwrap`.chomp
- system("#{rlwrap} #{BlueRidge.rhino_command} -f #{BlueRidge.plugin_prefix}/lib/shell.js -f -")
- end
-end
Something went wrong with that request. Please try again.