Passing arguments to an Rspec SpecTask
Posted
by Bayard Randel
on Stack Overflow
See other posts from Stack Overflow
or by Bayard Randel
Published on 2010-05-28T02:45:05Z
Indexed on
2010/05/28
2:51 UTC
Read the original article
Hit count: 267
Rake allows for the following syntax:
task :my_task, :arg1, :arg2 do |t, args|
puts "Args were: #{args}"
end
I'd like to be able to do the same, but with RSpecs SpecTask.
The following unfortunately fails:
desc "Run example with argument"
SpecTask.new('my_task'), :datafile do |t, args|
t.spec_files = FileList['cvd*_spec.rb -datafile=#{args}']
t.spec_opts = ["-c -f specdoc"]
end
Is it possible to achieve this with a SpecTask, or is there an alternative approach?
© Stack Overflow or respective owner