spec/spec/expectations/fail_with_spec.rb in rspec-0.8.2 vs spec/spec/expectations/fail_with_spec.rb in rspec-0.9.0
- old
+ new
@@ -1,71 +1,71 @@
require File.dirname(__FILE__) + '/../../spec_helper.rb'
-context "Spec::Expectations.fail_with with no diff" do
- setup do
+describe "Spec::Expectations.fail_with with no diff" do
+ before(:each) do
@old_differ = Spec::Expectations.differ
Spec::Expectations.differ = nil
end
- specify "should handle just a message" do
+ it "should handle just a message" do
lambda {
Spec::Expectations.fail_with "the message"
- }.should_fail_with "the message"
+ }.should fail_with("the message")
end
- specify "should handle an Array" do
+ it "should handle an Array" do
lambda {
Spec::Expectations.fail_with ["the message","expected","actual"]
- }.should_fail_with "the message"
+ }.should fail_with("the message")
end
- teardown do
+ after(:each) do
Spec::Expectations.differ = @old_differ
end
end
-context "Spec::Expectations.fail_with with diff" do
- setup do
+describe "Spec::Expectations.fail_with with diff" do
+ before(:each) do
@old_differ = Spec::Expectations.differ
@differ = mock("differ")
Spec::Expectations.differ = @differ
end
- specify "should not call differ if no expected/actual" do
+ it "should not call differ if no expected/actual" do
lambda {
Spec::Expectations.fail_with "the message"
- }.should_fail_with "the message"
+ }.should fail_with("the message")
end
- specify "should call differ if expected/actual are presented separately" do
+ it "should call differ if expected/actual are presented separately" do
@differ.should_receive(:diff_as_string).and_return("diff")
lambda {
Spec::Expectations.fail_with "the message", "expected", "actual"
- }.should_fail_with "the message\nDiff:diff"
+ }.should fail_with("the message\nDiff:diff")
end
- specify "should call differ if expected/actual are not strings" do
+ it "should call differ if expected/actual are not strings" do
@differ.should_receive(:diff_as_object).and_return("diff")
lambda {
Spec::Expectations.fail_with "the message", :expected, :actual
- }.should_fail_with "the message\nDiff:diff"
+ }.should fail_with("the message\nDiff:diff")
end
- specify "should not call differ if expected or actual are procs" do
+ it "should not call differ if expected or actual are procs" do
@differ.should_not_receive(:diff_as_string)
@differ.should_not_receive(:diff_as_object)
lambda {
Spec::Expectations.fail_with "the message", lambda {}, lambda {}
- }.should_fail_with "the message"
+ }.should fail_with("the message")
end
- specify "should call differ if expected/actual are presented in an Array with message" do
+ it "should call differ if expected/actual are presented in an Array with message" do
@differ.should_receive(:diff_as_string).with("actual","expected").and_return("diff")
lambda {
Spec::Expectations.fail_with(["the message", "expected", "actual"])
- }.should_fail_with /the message\nDiff:diff/
+ }.should fail_with(/the message\nDiff:diff/)
end
- teardown do
+ after(:each) do
Spec::Expectations.differ = @old_differ
end
end