Permalink
Browse files

piston status Cucumber tests

  • Loading branch information...
francois committed Jan 13, 2010
1 parent 79f634f commit f71a51bf8283d4be544e5e916259829d353526af
Showing with 42 additions and 2 deletions.
  1. +16 −1 features/import_to_git.feature
  2. +25 −0 features/step_definitions/repository.rb
  3. +1 −1 lib/piston/commands/status.rb
@@ -46,7 +46,22 @@ Feature: Import remote repository into a Git repository
And I should find a libcalc/libcalc.rb file
And I should find a libcalc/.piston.yml file
- Scenario: Importing into a specific folder when the parent folders doesn't exist succeeds
+ Given I committed
+ When I check the status
+ Then I should see an empty status report for "libcalc"
+
+ When I check the status with "--show-updates"
+ Then I should see an empty status report for "libcalc"
+
+ Given a file named libfix.rb with content "a\nb\nc" in remote libcalc project
+ When I check the status
+ Then I should see an empty status report for "libcalc"
+
+ When I check the status with "--show-updates"
+ Then I should see a change for "libcalc"
+ And I should see a remote change for "libcalc"
+
+ Scenario: Importing into a specific folder when the parent folder doesn't exist succeeds
Given a newly created Git project
And a remote Subversion project named libcalc using the classic layout
And a file named libcalc.rb with content "a\nb\nc" in remote libcalc project
@@ -239,3 +239,28 @@
STDERR.puts @stdout if $DEBUG
end
end
+
+When /^I check the status(?: with "([^"]+)")?$/ do |args|
+ Dir.chdir(@wcdir) do
+ cmd = "#{Tmpdir.piston} status --verbose 5"
+ cmd << " #{args}" if args
+ STDERR.puts cmd.inspect if $DEBUG
+ @stdout = `#{cmd}`
+ STDERR.puts @stdout if $DEBUG
+ end
+end
+
+Then /^I should see an empty status report for "([^"]+)"$/ do |project|
+ @stdout.should =~ /^\s+(?:\/private)?#{Regexp.escape(@wcdir + project)} \(file:\/\/#{Regexp.escape(@remotereposdir)}\)/
+end
+
+Then /^I should see a (?:(local|remote) )?change for "([^\"]*)"$/ do |local_remote, project|
+ case local_remote
+ when nil, ""
+ @stdout.should =~ /^[ M]{2}\s+(?:\/private)?#{Regexp.escape(@wcdir + project)} \(file:\/\/#{Regexp.escape(@remotereposdir)}\)/
+ when "local"
+ @stdout.should =~ /^M \s+(?:\/private)?#{Regexp.escape(@wcdir + project)} \(file:\/\/#{Regexp.escape(@remotereposdir)}\)/
+ when "remote"
+ @stdout.should =~ /^ M\s+(?:\/private)?#{Regexp.escape(@wcdir + project)} \(file:\/\/#{Regexp.escape(@remotereposdir)}\)/
+ end
+end
@@ -9,7 +9,7 @@ def run(wcdir)
props = Hash.new
# Then, get that repository's properties
- logger.debug {"Get info of #{path}"}
+ logger.debug {"Get info of #{wcdir}"}
working_copy = handler.new(wcdir)
working_copy.validate!
props.update(working_copy.info)

0 comments on commit f71a51b

Please sign in to comment.