Command line options in story runner run method

Hi,

Can anyone give me some sample syntax of using a command line switch
in the Story Runner run method please?

Thanks

Aidy

Hi,

2008/8/18 aidy lewis [email protected]:

Hi,

Can anyone give me some sample syntax of using a command line switch
in the Story Runner run method please?

This is what I have

def run_local_story(filename, options={})
options = {“-fh:” => “C:/rspec_reports/#{filename}.htm”}
run File.join(File.dirname(FILE), “…/projects/#{filename}”),
options
end

However, no exception is thrown, but neither is a file created. I am
also unsure on what part of the code the html report should be
created.

Aidy

On Mon, Aug 18, 2008 at 12:01 PM, aidy lewis [email protected]
wrote:

def run_local_story(filename, options={})
options = {“-fh:” => “C:/rspec_reports/#{filename}.htm”}
run File.join(File.dirname(FILE), “…/projects/#{filename}”), options
end

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

HTH,
David

On Tue, Aug 19, 2008 at 7:09 AM, aidy lewis [email protected]
wrote:

with_steps_for :accounting do

 path = path.gsub("/", "\\")
 full_path = source_location + path
 system("ruby #{full_path} -fh: C:\\rspec_reports\\#{Time.now.to_i}.htm")

end
end
end

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?

Hi David,

2008/8/18 David C. [email protected]:

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.

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

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

Hi David,

Thanks for getting back. I piped it.

system(“ruby #{full_path} -fh > C:\rspec_reports\#{file_name}.htm”)

Works fine (in windows)

Aidy

2008/8/20 David C. [email protected]: