changelog shortlog tags changeset manifest revisions annotate raw

vendor/plugins/rspec/spec/spec/matchers/matcher_methods_spec.rb

changeset 15: 64acf98d15f4
author: moriq@moriq.com
date: Mon Mar 10 10:12:58 2008 +0900 (16 years ago)
permissions: -rw-r--r--
description: add plugins rspec
1require File.dirname(__FILE__) + '/../../spec_helper.rb'
2
3module Spec
4 module Matchers
5 context %Q{The Spec::Matchers module gets included in the execution context of every spec.
6This module should provide the following methods, each of which returns a Matcher object.} do
7 it "be_true" do
8 be_true.should be_an_instance_of(Be)
9 end
10 it "be_false" do
11 be_false.should be_an_instance_of(Be)
12 end
13 it "be_nil" do
14 be_nil.should be_an_instance_of(Be)
15 end
16 it "be_arbitrary_predicate" do
17 be_arbitrary_predicate.should be_an_instance_of(Be)
18 end
19 it "be_close" do
20 be_close(1,2).should be_an_instance_of(BeClose)
21 end
22 it "change" do
23 change("target", :message).should be_an_instance_of(Change)
24 end
25 it "eql" do
26 eql(:expected).should be_an_instance_of(Eql)
27 end
28 it "equal" do
29 equal(:expected).should be_an_instance_of(Equal)
30 end
31 it "have" do
32 have(0).should be_an_instance_of(Have)
33 end
34 it "have_exactly" do
35 have_exactly(0).should be_an_instance_of(Have)
36 end
37 it "have_at_least" do
38 have_at_least(0).should be_an_instance_of(Have)
39 end
40 it "have_at_most" do
41 have_at_most(0).should be_an_instance_of(Have)
42 end
43 it "include" do
44 include(:value).should be_an_instance_of(Include)
45 end
46 it "match" do
47 match(:value).should be_an_instance_of(Match)
48 end
49 it "raise_error" do
50 raise_error.should be_an_instance_of(RaiseError)
51 raise_error(NoMethodError).should be_an_instance_of(RaiseError)
52 raise_error(NoMethodError, "message").should be_an_instance_of(RaiseError)
53 end
54 it "satisfy" do
55 satisfy{}.should be_an_instance_of(Satisfy)
56 end
57 it "throw_symbol" do
58 throw_symbol.should be_an_instance_of(ThrowSymbol)
59 throw_symbol(:sym).should be_an_instance_of(ThrowSymbol)
60 end
61 it "respond_to" do
62 respond_to(:sym).should be_an_instance_of(RespondTo)
63 end
64 end
65
66 describe "Spec::Matchers#method_missing" do
67 it "should convert be_xyz to Be(:be_xyz)" do
68 Be.should_receive(:new).with(:be_whatever)
69 be_whatever
70 end
71
72 it "should convert have_xyz to Has(:have_xyz)" do
73 Has.should_receive(:new).with(:have_whatever)
74 have_whatever
75 end
76 end
77 end
78end