Added Rspec and Webrat plugins and started porting Selenium on Rails tests to Rspec Plain Text Stories driving Webrat driving Selenium.

This commit is contained in:
Luke Melia 2008-06-18 02:57:57 -04:00
parent 0600756bbf
commit 0f7d6f7a1d
602 changed files with 47788 additions and 29 deletions

View file

@ -0,0 +1,63 @@
module Spec
module Expectations
# rspec adds #should and #should_not to every Object (and,
# implicitly, every Class).
module ObjectExpectations
# :call-seq:
# should(matcher)
# should == expected
# should === expected
# should =~ expected
#
# receiver.should(matcher)
# => Passes if matcher.matches?(receiver)
#
# receiver.should == expected #any value
# => Passes if (receiver == expected)
#
# receiver.should === expected #any value
# => Passes if (receiver === expected)
#
# receiver.should =~ regexp
# => Passes if (receiver =~ regexp)
#
# See Spec::Matchers for more information about matchers
#
# == Warning
#
# NOTE that this does NOT support receiver.should != expected.
# Instead, use receiver.should_not == expected
def should(matcher=:use_operator_matcher, &block)
ExpectationMatcherHandler.handle_matcher(self, matcher, &block)
end
# :call-seq:
# should_not(matcher)
# should_not == expected
# should_not === expected
# should_not =~ expected
#
# receiver.should_not(matcher)
# => Passes unless matcher.matches?(receiver)
#
# receiver.should_not == expected
# => Passes unless (receiver == expected)
#
# receiver.should_not === expected
# => Passes unless (receiver === expected)
#
# receiver.should_not =~ regexp
# => Passes unless (receiver =~ regexp)
#
# See Spec::Matchers for more information about matchers
def should_not(matcher=:use_operator_matcher, &block)
NegativeExpectationMatcherHandler.handle_matcher(self, matcher, &block)
end
end
end
end
class Object
include Spec::Expectations::ObjectExpectations
end

View file

@ -0,0 +1,17 @@
module Spec
module Expectations
module StringHelpers
def starts_with?(prefix)
to_s[0..(prefix.to_s.length - 1)] == prefix.to_s
end
end
end
end
class String
include Spec::Expectations::StringHelpers
end
class Symbol
include Spec::Expectations::StringHelpers
end