Skip to content

Commit

Permalink
move to rspec 2
Browse files Browse the repository at this point in the history
  • Loading branch information
tdgs committed Jan 13, 2012
1 parent 8f026bb commit 315a400
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
9 changes: 9 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

require 'rubygems'
require 'serenity'
require 'ruby-debug'
require 'rspec'

Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}

Ship = Struct.new(:name, :type)
Expand All @@ -10,3 +13,9 @@
def fixture name
File.join(File.dirname(__FILE__), '..', 'fixtures', name)
end

RSpec.configure do |config|
config.filter_run :focus => true
config.run_all_when_everything_filtered = true
end

2 changes: 1 addition & 1 deletion spec/support/matchers/be_a_document.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Serenity
Spec::Matchers.define :be_a_document do
RSpec::Matchers.define :be_a_document do
match do |actual|
File.exists? actual
end
Expand Down
5 changes: 4 additions & 1 deletion spec/support/matchers/contain_in.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# encoding: utf-8

require "zip/zip"

module Serenity
Spec::Matchers.define :contain_in do |xml_file, expected|
RSpec::Matchers.define :contain_in do |xml_file, expected|

match do |actual|
content = Zip::ZipFile.open(actual) { |zip_file| zip_file.read(xml_file) }
content.force_encoding("UTF-8")
content =~ Regexp.new(".*#{Regexp.escape(expected)}.*")
end

Expand Down

0 comments on commit 315a400

Please sign in to comment.