From 563e2f520074a75a4a0826261cc4c55fc79f10f9 Mon Sep 17 00:00:00 2001 From: Sam Phippen Date: Fri, 10 May 2013 20:40:19 +0100 Subject: [PATCH] Enable the :expect syntax by default. Signed-off-by: Sam Phippen --- .../expect_message_using_expect.feature | 15 --------------- lib/rspec/mocks/configuration.rb | 2 +- spec/rspec/mocks/configuration_spec.rb | 4 ++-- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/features/message_expectations/expect_message_using_expect.feature b/features/message_expectations/expect_message_using_expect.feature index 8746f4eb5..c67bca9ee 100644 --- a/features/message_expectations/expect_message_using_expect.feature +++ b/features/message_expectations/expect_message_using_expect.feature @@ -4,21 +4,10 @@ Feature: expect message using `expect` `object` should receive the message `:message` before the example is completed. - Background: - Given a file named "spec/spec_helper.rb" with: - """ruby - RSpec.configure do |config| - config.mock_with :rspec do |mocks| - mocks.syntax = :expect - end - end - """ - Scenario: expect a message Given a file named "spec/account_spec.rb" with: """ruby require "account" - require "spec_helper" describe Account do context "when closed" do @@ -48,7 +37,6 @@ Feature: expect message using `expect` Given a file named "spec/account_spec.rb" with: """ruby require "account" - require "spec_helper" describe Account do context "when closed" do @@ -77,7 +65,6 @@ Feature: expect message using `expect` Scenario: provide a return value Given a file named "spec/message_expectation_spec.rb" with: """ruby - require "spec_helper" describe "a message expectation with a return value" do context "specified in a block" do @@ -103,8 +90,6 @@ Feature: expect message using `expect` Scenario: expect a specific number of calls Given a file named "spec/message_count_spec.rb" with: """ruby - require "spec_helper" - describe "a message expectation with a count" do it "passes if the expected number of calls happen" do string = "hi" diff --git a/lib/rspec/mocks/configuration.rb b/lib/rspec/mocks/configuration.rb index f8185c887..4e5cd8cc4 100644 --- a/lib/rspec/mocks/configuration.rb +++ b/lib/rspec/mocks/configuration.rb @@ -49,7 +49,7 @@ def self.configuration @configuration ||= Configuration.new end - configuration.syntax = :should + configuration.syntax = [:should, :expect] end end diff --git a/spec/rspec/mocks/configuration_spec.rb b/spec/rspec/mocks/configuration_spec.rb index b0239bd7b..93d9a6e20 100644 --- a/spec/rspec/mocks/configuration_spec.rb +++ b/spec/rspec/mocks/configuration_spec.rb @@ -35,9 +35,9 @@ def sandboxed let(:should_class_methods) { [:any_instance] } let(:expect_methods) { [:receive, :allow, :expect_any_instance_of, :allow_any_instance_of] } - it 'defaults to only enabling the :should syntax' do + it 'defaults to enabling both the :should and :expect syntaxes' do expect(dbl).to respond_to(*should_methods) - expect(self).not_to respond_to(*expect_methods) + expect(self).to respond_to(*expect_methods) end context 'when configured to :expect' do