Skip to content

Commit

Permalink
#5 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Yegor Bugayenko committed Aug 7, 2014
1 parent b99ff3c commit e62ceaa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions bin/pdd
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ end
if opts.help?
puts opts
else
file = opts.file? ? opts[:file] : STDOUT
File.write(file, PDD::Base.new(opts).xml)
file = opts.file? ? File.new(opts[:file], 'w') : STDOUT
file << PDD::Base.new(opts).xml
end
4 changes: 2 additions & 2 deletions features/cli.feature
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ Feature: Command Line Processing
~~ and second
~~
"""
When I run bin/pdd with " "
When I run bin/pdd with "> out.xml"
Then Exit code is zero
And Stdout contains "<puzzles>"
And XML file "out.xml" matches "/puzzles[count(puzzle)=1]"
1 change: 1 addition & 0 deletions features/step_definitions/steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
end

Then(/^XML file "([^"]+)" matches "([^"]+)"$/) do |file, xpath|
fail "File #{file} doesn't exit" unless File.exist?(file)
xml = Nokogiri::XML.parse(File.read(file))
if xml.xpath(xpath).empty?
fail "XML file #{file} doesn't match \"#{xpath}\":\n#{xml}"
Expand Down

0 comments on commit e62ceaa

Please sign in to comment.