test/test_pdd.rb in pdd-0.1 vs test/test_pdd.rb in pdd-0.2
- old
+ new
@@ -23,19 +23,24 @@
require 'minitest/autorun'
require 'nokogiri'
require 'pdd'
require 'tmpdir'
+require 'slop'
# PDD main module test.
# Author:: Yegor Bugayenko (yegor@teamed.io)
# Copyright:: Copyright (c) 2014 Yegor Bugayenko
# License:: MIT
class TestPDD < Minitest::Test
def test_basic
Dir.mktmpdir 'test' do |dir|
+ opts = Slop.parse ['-v', '-s', dir] do
+ on 'v', 'verbose'
+ on 's', 'source', argument: :required
+ end
File.write(File.join(dir, 'a.txt'), '@todo #55 hello!')
- xml = Nokogiri::XML::Document.parse(PDD::Base.new(dir).xml)
- assert_equal xml.xpath('/puzzles/puzzle[file="a.txt"]').size, 1
+ xml = Nokogiri::XML::Document.parse(PDD::Base.new(opts).xml)
+ assert_equal 1, xml.xpath('/puzzles/puzzle[file="a.txt"]').size
end
end
end