diff --git a/spec/expectations/value_expectation_spec.cr b/spec/expectations/expectation_spec.cr similarity index 81% rename from spec/expectations/value_expectation_spec.cr rename to spec/expectations/expectation_spec.cr index 4a82f92..42b95dd 100644 --- a/spec/expectations/value_expectation_spec.cr +++ b/spec/expectations/expectation_spec.cr @@ -1,13 +1,13 @@ require "../spec_helper" -describe Spectator::Expectations::ValueExpectation do +describe Spectator::Expectations::Expectation do describe "#satisifed?" do context "with a successful match" do it "is true" do value = 42 partial = Spectator::Expectations::ValueExpectationPartial.new(value.to_s, value) matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value) - expectation = Spectator::Expectations::ValueExpectation.new(true, false, partial, matcher) + expectation = Spectator::Expectations::Expectation.new(true, false, partial, matcher) matcher.match?(partial).should be_true # Sanity check. expectation.satisfied?.should be_true end @@ -17,7 +17,7 @@ describe Spectator::Expectations::ValueExpectation do value = 42 partial = Spectator::Expectations::ValueExpectationPartial.new(value.to_s, value) matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value) - expectation = Spectator::Expectations::ValueExpectation.new(true, true, partial, matcher) + expectation = Spectator::Expectations::Expectation.new(true, true, partial, matcher) matcher.match?(partial).should be_true # Sanity check. expectation.satisfied?.should be_false end @@ -30,7 +30,7 @@ describe Spectator::Expectations::ValueExpectation do value2 = 777 partial = Spectator::Expectations::ValueExpectationPartial.new(value1.to_s, value1) matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2) - expectation = Spectator::Expectations::ValueExpectation.new(false, false, partial, matcher) + expectation = Spectator::Expectations::Expectation.new(false, false, partial, matcher) matcher.match?(partial).should be_false # Sanity check. expectation.satisfied?.should be_false end @@ -41,7 +41,7 @@ describe Spectator::Expectations::ValueExpectation do value2 = 777 partial = Spectator::Expectations::ValueExpectationPartial.new(value1.to_s, value1) matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2) - expectation = Spectator::Expectations::ValueExpectation.new(false, true, partial, matcher) + expectation = Spectator::Expectations::Expectation.new(false, true, partial, matcher) matcher.match?(partial).should be_false # Sanity check. expectation.satisfied?.should be_true end @@ -55,7 +55,7 @@ describe Spectator::Expectations::ValueExpectation do value = 42 partial = Spectator::Expectations::ValueExpectationPartial.new(value.to_s, value) matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value) - expectation = Spectator::Expectations::ValueExpectation.new(true, false, partial, matcher) + expectation = Spectator::Expectations::Expectation.new(true, false, partial, matcher) matcher.match?(partial).should be_true # Sanity check. expectation.actual_message.should eq(matcher.message(partial)) end @@ -65,7 +65,7 @@ describe Spectator::Expectations::ValueExpectation do value = 42 partial = Spectator::Expectations::ValueExpectationPartial.new(value.to_s, value) matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value) - expectation = Spectator::Expectations::ValueExpectation.new(true, true, partial, matcher) + expectation = Spectator::Expectations::Expectation.new(true, true, partial, matcher) matcher.match?(partial).should be_true # Sanity check. expectation.actual_message.should eq(matcher.negated_message(partial)) end @@ -78,7 +78,7 @@ describe Spectator::Expectations::ValueExpectation do value2 = 777 partial = Spectator::Expectations::ValueExpectationPartial.new(value1.to_s, value1) matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2) - expectation = Spectator::Expectations::ValueExpectation.new(false, false, partial, matcher) + expectation = Spectator::Expectations::Expectation.new(false, false, partial, matcher) matcher.match?(partial).should be_false # Sanity check. expectation.actual_message.should eq(matcher.negated_message(partial)) end @@ -89,7 +89,7 @@ describe Spectator::Expectations::ValueExpectation do value2 = 777 partial = Spectator::Expectations::ValueExpectationPartial.new(value1.to_s, value1) matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2) - expectation = Spectator::Expectations::ValueExpectation.new(false, true, partial, matcher) + expectation = Spectator::Expectations::Expectation.new(false, true, partial, matcher) matcher.match?(partial).should be_false # Sanity check. expectation.actual_message.should eq(matcher.message(partial)) end @@ -103,7 +103,7 @@ describe Spectator::Expectations::ValueExpectation do value = 42 partial = Spectator::Expectations::ValueExpectationPartial.new(value.to_s, value) matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value) - expectation = Spectator::Expectations::ValueExpectation.new(true, false, partial, matcher) + expectation = Spectator::Expectations::Expectation.new(true, false, partial, matcher) matcher.match?(partial).should be_true # Sanity check. expectation.expected_message.should eq(matcher.message(partial)) end @@ -113,7 +113,7 @@ describe Spectator::Expectations::ValueExpectation do value = 42 partial = Spectator::Expectations::ValueExpectationPartial.new(value.to_s, value) matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value) - expectation = Spectator::Expectations::ValueExpectation.new(true, true, partial, matcher) + expectation = Spectator::Expectations::Expectation.new(true, true, partial, matcher) matcher.match?(partial).should be_true # Sanity check. expectation.expected_message.should eq(matcher.negated_message(partial)) end @@ -126,7 +126,7 @@ describe Spectator::Expectations::ValueExpectation do value2 = 777 partial = Spectator::Expectations::ValueExpectationPartial.new(value1.to_s, value1) matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2) - expectation = Spectator::Expectations::ValueExpectation.new(false, false, partial, matcher) + expectation = Spectator::Expectations::Expectation.new(false, false, partial, matcher) matcher.match?(partial).should be_false # Sanity check. expectation.expected_message.should eq(matcher.message(partial)) end @@ -137,7 +137,7 @@ describe Spectator::Expectations::ValueExpectation do value2 = 777 partial = Spectator::Expectations::ValueExpectationPartial.new(value1.to_s, value1) matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2) - expectation = Spectator::Expectations::ValueExpectation.new(false, true, partial, matcher) + expectation = Spectator::Expectations::Expectation.new(false, true, partial, matcher) matcher.match?(partial).should be_false # Sanity check. expectation.expected_message.should eq(matcher.negated_message(partial)) end diff --git a/spec/helpers/expectations_helper.cr b/spec/helpers/expectations_helper.cr index 4e8726a..dd99087 100644 --- a/spec/helpers/expectations_helper.cr +++ b/spec/helpers/expectations_helper.cr @@ -20,7 +20,7 @@ def new_expectation(expected : ExpectedType = 123, actual : ActualType = 123) fo partial = new_partial("foo", actual) matcher = new_matcher("bar", expected) matched = matcher.match?(partial) - Spectator::Expectations::ValueExpectation.new(matched, false, partial, matcher).as(Spectator::Expectations::Expectation) + Spectator::Expectations::Expectation.new(matched, false, partial, matcher) end def new_satisfied_expectation(value : T = 123) forall T