[rspec-users] command line options in story runner run method

aidy lewis aidy.lewis at googlemail.com
Tue Aug 19 08:09:05 EDT 2008


Hi David,

2008/8/18 David Chelimsky <dchelimsky at gmail.com>:

> Those options don't make it to the runner, which reads the actual
> command line (ARGV).
>
> What I typically do is load up runner files that look like this:
>
> # stories/accounting/stories.rb
> with_steps_for :accounting do
>  run 'path/to/a/story/file'
> end
>
> The, in a terminal:
>
> $ ruby stories/accounting/stories.rb -fh:/rspec_reports/#{filename}.htm

I created a rake file that cycles through a number of runner folders
and runs individual ruby files using the kernal 'system' method so
that I can produce HTML reports.

<rake>
task :dcs do
  require 'find'
  Find.find("projects/dcs/runner") do |path|
    path.length
    string_end = path.length
    string_begin = string_end -3
    result = path.slice string_begin ... string_end
    if result == ".rb"
      source_location  =  "C:\\SvnProjects\\RubyUatFramework\\test\\"
      path = path.gsub("/", "\\")
      full_path = source_location + path
      system("ruby #{full_path} -fh: C:\\rspec_reports\\#{Time.now.to_i}.htm")
    end
   end
end
</rake>

However, I think I am having problems with the format switch. The HTML
will appear in the console but not on the file system.

Thanks for the help

Aidy


More information about the rspec-users mailing list