Skip to content

Commit

Permalink
added pik_install scenarios, test for install to location with spaces…
Browse files Browse the repository at this point in the history
… in path
  • Loading branch information
vertiginous committed Oct 19, 2009
1 parent f569f63 commit fb7e092
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
24 changes: 24 additions & 0 deletions features/pik_install.feature
@@ -0,0 +1,24 @@
Feature: pik_install binary script
In order to use pik
A developer
Wants a command line interface
So that she can install the pik tool

Scenario: pik_install
Given I have not installed pik to C:\temp\bin
And "C:\temp\bin" is in the system path
When I run "pik_install C:\temp\bin"
And then I run "C:\temp\bin\pik help"
Then I should see "Installing to C:\temp\bin"
And I should see "pik is installed"
And I should see "To get help with a command"


Scenario: pik_install to path with spaces
Given I have not installed pik to C:\temp\path with spaces\bin
And "C:\temp\path with spaces\bin" is in the system path
When I run "pik_install "C:\temp\path with spaces\bin""
And then I run "pik help"
Then I should see "Installing to C:\temp\path with spaces\bin"
And I should see "pik is installed"
And I should see "To get help with a command"
18 changes: 18 additions & 0 deletions features/step_definitions/pik_commands.rb
Expand Up @@ -46,6 +46,20 @@
File.open(PIK_HOME + 'config.yml','w'){|f| }
end

Given /^I have not installed pik to (.+)$/ do |path|
FileUtils.rm_rf path if File.exist? path
FileUtils.mkdir_p path
Dir[path + "\\pik.bat"].should be_empty
end

Given /^"(.*)" is in the system path$/ do |arg1|
ENV['PATH'] = [arg1, ENV['PATH']].join(';')
end

When /^I run "pik_install (.+)"$/ do |args|
%x[ruby bin/pik_install #{args} > #{PIK_LOG} 2>&1 ]
end

When /^I run "pik (.+?)" and "pik (.+)",$/ do |args1, args2|
%x[tools\\pik.bat #{args1} > #{PIK_LOG} 2>&1 && tools\\pik.bat #{args2} > #{PIK_LOG} 2>&1]
end
Expand All @@ -58,6 +72,10 @@
%x[tools\\pik.bat #{args} > #{PIK_LOG} 2>&1 & PATH >> #{PIK_LOG} ]
end

And /^then I run "(.*)"$/ do |args|
%x[#{args} >> #{PIK_LOG} 2>&1 ]
end

Then /^I should see "(.*)"$/ do |data|
stdout = File.read(PIK_LOG)
stdout.should match(Regexp.new(Regexp.escape(data)))
Expand Down

0 comments on commit fb7e092

Please sign in to comment.