spec/spec_helper.rb in rpub-0.2.0 vs spec/spec_helper.rb in rpub-0.2.1
- old
+ new
@@ -1,5 +1,10 @@
+if RUBY_VERSION >= '1.9'
+ require 'simplecov'
+ SimpleCov.start
+end
+
require 'rpub'
require 'nokogiri'
FIXTURES_DIRECTORY = File.expand_path('../fixtures', __FILE__)
@@ -10,14 +15,14 @@
after = File.exist?(filename)
before && !after
end
end
-RSpec::Matchers.define :create_file do |filename|
+RSpec::Matchers.define :create_file do |*filenames|
match do |block|
- before = File.exist?(filename)
+ before = filenames.all?(&File.method(:exist?))
block.call
- after = File.exist?(filename)
+ after = filenames.all?(&File.method(:exist?))
!before && after
end
end
RSpec::Matchers.define :have_xpath do |xpath, *args|