Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add changelog to rdoc

  • Loading branch information...
commit 36f2c5dc70bf7c00dfbdd8de5c6078ecd4535297 1 parent 9cd937b
@dchelimsky dchelimsky authored
View
1  .yardopts
@@ -4,3 +4,4 @@
--markup markdown
-
License.txt
+Changelog.md
View
16 benchmarks/autoload_v_require.rb
@@ -0,0 +1,16 @@
+$:.unshift File.expand_path("../../lib", __FILE__)
+require 'benchmark'
+
+n = 20
+
+Benchmark.benchmark do |bm|
+ 3.times do
+ bm.report do
+ n.times do
+ fork do
+ require 'rspec/expectations'
+ end
+ end
+ end
+ end
+end
View
60 spec/rspec/matchers/base_matcher_spec.rb
@@ -0,0 +1,60 @@
+require "spec_helper"
+
+describe "base matcher" do
+ describe "#match_unless_raises" do
+ context "with an assertion" do
+ let(:mod) do
+ Module.new do
+ def assert_equal(a,b)
+ a == b ? nil : (raise UnexpectedError.new("#{b} does not equal #{a}"))
+ end
+ end
+ end
+ let(:matcher) do
+ m = mod
+ Class.new do
+ include BaseMatcher
+ extend m
+ match_unless_raises UnexpectedError do
+ assert_equal expected, actual
+ end
+ end
+ end
+
+ context "with passing assertion" do
+ it "passes" do
+ matcher.matches?(4).should be_true
+ end
+ end
+
+ context "with failing assertion" do
+ it "fails" do
+ matcher.matches?(5).should be_false
+ end
+
+ it "provides the raised exception" do
+ matcher.matches?(5)
+ matcher.rescued_exception.message.
+ should eq("5 does not equal 4")
+ end
+ end
+ end
+
+ context "with an unexpected error" do
+ let(:matcher) do
+ RSpec::Matchers::Matcher.new :foo, :bar do |expected|
+ match_unless_raises SyntaxError do |actual|
+ raise "unexpected exception"
+ end
+ end
+ end
+
+ it "raises the error" do
+ expect do
+ matcher.matches?(:bar)
+ end.to raise_error("unexpected exception")
+ end
+ end
+
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.