Wrapper tasks for :assets-dependent Jasmine tasks
The :browse_jasmine_<system> and :phantomjs_jasmine_<system> tasks depend on the :assets task, which needs to receive both :system and :env arguments. Therefore, new tasks (:browse_jasmine and :phantomjs_jasmine) are created that do take :system and :env args. The old :browse_jasmine_<system> and :phantomjs_jasmine_<system> tasks now wrap the new tasks, passing in <system> as an argument and 'jasmine' (for :env, since it's hardcoded to 'jasmine' in django_for_jasmine()).
This commit is contained in:
@@ -73,21 +73,43 @@ def run_phantom_js(url)
|
||||
sh("#{phantomjs} node_modules/jasmine-reporters/test/phantomjs-testrunner.js #{url}")
|
||||
end
|
||||
|
||||
# Open jasmine tests for :system in the default browser. The :env
|
||||
# should (always?) be 'jasmine', but it's passed as an arg so that
|
||||
# the :assets dependency gets it.
|
||||
#
|
||||
# This task should be invoked via the wrapper below, so we don't
|
||||
# include a description to keep it from showing up in rake -T.
|
||||
task :browse_jasmine, [:system, :env] => :assets do |t, args|
|
||||
django_for_jasmine(args.system, true) do |jasmine_url|
|
||||
Launchy.open(jasmine_url)
|
||||
puts "Press ENTER to terminate".red
|
||||
$stdin.gets
|
||||
end
|
||||
end
|
||||
|
||||
# Use phantomjs to run jasmine tests from the console. The :env
|
||||
# should (always?) be 'jasmine', but it's passed as an arg so that
|
||||
# the :assets dependency gets it.
|
||||
#
|
||||
# This task should be invoked via the wrapper below, so we don't
|
||||
# include a description to keep it from showing up in rake -T.
|
||||
task :phantomjs_jasmine, [:system, :env] => :assets do |t, args|
|
||||
django_for_jasmine(args.system, false) do |jasmine_url|
|
||||
run_phantom_js(jasmine_url)
|
||||
end
|
||||
end
|
||||
|
||||
# Wrapper tasks for the real browse_jasmine and phantomjs_jasmine
|
||||
# tasks above. These have a nicer UI since there's no arg passing.
|
||||
[:lms, :cms].each do |system|
|
||||
desc "Open jasmine tests for #{system} in your default browser"
|
||||
task "browse_jasmine_#{system}" => :assets do
|
||||
django_for_jasmine(system, true) do |jasmine_url|
|
||||
Launchy.open(jasmine_url)
|
||||
puts "Press ENTER to terminate".red
|
||||
$stdin.gets
|
||||
end
|
||||
task "browse_jasmine_#{system}" do
|
||||
task(:browse_jasmine).invoke(system, 'jasmine')
|
||||
end
|
||||
|
||||
desc "Use phantomjs to run jasmine tests for #{system} from the console"
|
||||
task "phantomjs_jasmine_#{system}" => :assets do
|
||||
django_for_jasmine(system, false) do |jasmine_url|
|
||||
run_phantom_js(jasmine_url)
|
||||
end
|
||||
task "phantomjs_jasmine_#{system}" do
|
||||
task(:phantomjs_jasmine).invoke(system, 'jasmine')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user