lib/qunited/rake_task.rb in qunited-0.4.4 vs lib/qunited/rake_task.rb in qunited-0.5.0
- old
+ new
@@ -32,10 +32,14 @@
# Array or glob pattern of test helper files. These include extra libraries for mocks or other
# test tools. These are loaded after source files and before test files. These will be loaded
# in order if specified as an array.
attr_accessor :helper_files
+ # Array or glob pattern of fixture files. These are included under the #qunit-fixture element
+ # on the test page. These will be included in order if specified as an array.
+ attr_accessor :fixture_files
+
# The driver to use to run the QUnit tests.
attr_accessor :driver
# Use verbose output. If this is true, the task will print the QUnited command to stdout.
#
@@ -104,10 +108,11 @@
task (name.to_s + ':server') do
require 'qunited/server'
server_options = {
:source_files => source_and_helper_files,
:test_files => test_files_to_run,
+ :fixture_files => fixture_files_to_include,
:verbose => verbose
}
server_options[:port] = @server_port if @server_port
::QUnited::Server.new(server_options).start
end
@@ -116,18 +121,23 @@
private
def test_command
cmd = 'qunited'
cmd << " --driver #{driver}" if driver
+ cmd << " --fixtures #{fixture_files_to_include.join(',')}" if fixture_files
cmd << " #{source_and_helper_files.join(' ')} -- #{test_files_to_run.join(' ')}"
end
def source_files_to_include
files_array source_files
end
def helper_files_to_include
files_array helper_files
+ end
+
+ def fixture_files_to_include
+ files_array fixture_files
end
def test_files_to_run
files_array test_files
end