aidy lewis
2008-Aug-18 16:00 UTC
[rspec-users] 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
aidy lewis
2008-Aug-18 17:01 UTC
[rspec-users] command line options in story runner run method
Hi, 2008/8/18 aidy lewis <aidy.lewis at googlemail.com>:> 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
David Chelimsky
2008-Aug-18 17:07 UTC
[rspec-users] command line options in story runner run method
On Mon, Aug 18, 2008 at 12:01 PM, aidy lewis <aidy.lewis at googlemail.com> wrote:> Hi, > > 2008/8/18 aidy lewis <aidy.lewis at googlemail.com>: >> 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 >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> 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 > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
aidy lewis
2008-Aug-19 12:09 UTC
[rspec-users] command line options in story runner run method
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}.htmI 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
David Chelimsky
2008-Aug-20 16:37 UTC
[rspec-users] command line options in story runner run method
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 >
aidy lewis
2008-Aug-20 16:45 UTC
[rspec-users] command line options in story runner run method
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 Chelimsky <dchelimsky at gmail.com>:> 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 >> > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >