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

David Chelimsky dchelimsky at gmail.com
Wed Aug 20 12:37:35 EDT 2008


On Tue, Aug 19, 2008 at 7:09 AM, aidy lewis <aidy.lewis at googlemail.com> wrote:
> 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.

Try removing the space between ":" and "C:\\":

  system("ruby #{full_path} -fh:C:\\rspec_reports\\#{Time.now.to_i}.htm")

That work?

>
> Thanks for the help
>
> Aidy
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list