1515 test_file = configuration . docs_dir . join ( "test" )
1616 FileUtils . mkdir_p configuration . docs_dir
1717 FileUtils . touch test_file
18- FileUtils . stub ( :cp_r )
18+ allow ( FileUtils ) . to receive ( :cp_r )
1919 subject . clear_docs
2020
21- File . directory? ( configuration . docs_dir ) . should be_truthy
22- File . exists? ( test_file ) . should be_falsey
21+ expect ( File . directory? ( configuration . docs_dir ) ) . to be_truthy
22+ expect ( File . exists? ( test_file ) ) . to be_falsey
2323 end
2424 end
2525
3030 let! ( :wrapped_example ) { RspecApiDocumentation ::Example . new ( example , configuration ) }
3131
3232 before do
33- RspecApiDocumentation ::Example . stub ( :new ) . and_return ( wrapped_example )
33+ allow ( RspecApiDocumentation ::Example ) . to receive ( :new ) . and_return ( wrapped_example )
3434 end
3535
3636 it "should create a new wrapped example" do
37- RspecApiDocumentation ::Example . should_receive ( :new ) . with ( example , configuration ) . and_return ( wrapped_example )
37+ expect ( RspecApiDocumentation ::Example ) . to receive ( :new ) . with ( example , configuration ) . and_return ( wrapped_example )
3838 documentation . document_example ( example )
3939 end
4040
4141 context "when the given example should be documented" do
42- before { wrapped_example . stub ( :should_document? ) . and_return ( true ) }
42+ before { allow ( wrapped_example ) . to receive ( :should_document? ) . and_return ( true ) }
4343
4444 it "should add the wrapped example to the index" do
4545 documentation . document_example ( example )
46- documentation . index . examples . should eq ( [ wrapped_example ] )
46+ expect ( documentation . index . examples ) . to eq ( [ wrapped_example ] )
4747 end
4848 end
4949
5050 context "when the given example should not be documented" do
51- before { wrapped_example . stub ( :should_document? ) . and_return ( false ) }
51+ before { allow ( wrapped_example ) . to receive ( :should_document? ) . and_return ( false ) }
5252
5353 it "should not add the wrapped example to the index" do
5454 documentation . document_example ( example )
55- documentation . index . examples . should be_empty
55+ expect ( documentation . index . examples ) . to be_empty
5656 end
5757 end
5858 end
@@ -68,8 +68,9 @@ class RspecApiDocumentation::Writers::TextileWriter; end
6868 end
6969
7070 it "should return the classes from format" do
71- subject . writers . should == [ RspecApiDocumentation ::Writers ::HtmlWriter , RspecApiDocumentation ::Writers ::JsonWriter ,
72- RspecApiDocumentation ::Writers ::TextileWriter ]
71+ expect ( subject . writers ) . to eq ( [ RspecApiDocumentation ::Writers ::HtmlWriter ,
72+ RspecApiDocumentation ::Writers ::JsonWriter ,
73+ RspecApiDocumentation ::Writers ::TextileWriter ] )
7374 end
7475 end
7576
@@ -79,7 +80,7 @@ class RspecApiDocumentation::Writers::TextileWriter; end
7980 end
8081
8182 it "should return the classes from format" do
82- subject . writers . should == [ RspecApiDocumentation ::Writers ::HtmlWriter ]
83+ expect ( subject . writers ) . to eq ( [ RspecApiDocumentation ::Writers ::HtmlWriter ] )
8384 end
8485 end
8586 end
@@ -90,13 +91,13 @@ class RspecApiDocumentation::Writers::TextileWriter; end
9091 let ( :textile_writer ) { double ( :textile_writer ) }
9192
9293 before do
93- subject . stub ( :writers => [ html_writer , json_writer , textile_writer ] )
94+ allow ( subject ) . to receive ( :writers ) . and_return ( [ html_writer , json_writer , textile_writer ] )
9495 end
9596
9697 it "should write the docs in each format" do
97- html_writer . should_receive ( :write ) . with ( subject . index , configuration )
98- json_writer . should_receive ( :write ) . with ( subject . index , configuration )
99- textile_writer . should_receive ( :write ) . with ( subject . index , configuration )
98+ expect ( html_writer ) . to receive ( :write ) . with ( subject . index , configuration )
99+ expect ( json_writer ) . to receive ( :write ) . with ( subject . index , configuration )
100+ expect ( textile_writer ) . to receive ( :write ) . with ( subject . index , configuration )
100101 subject . write
101102 end
102103 end
0 commit comments