From d514c663271502b3a58fae9e1ea4b0054c0ad1be Mon Sep 17 00:00:00 2001 From: Hagen Schink Date: Mon, 13 Oct 2014 15:51:30 +0200 Subject: [PATCH] Ensure each action is called once --- .../controllers/api/experimental/queries_controller_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/controllers/api/experimental/queries_controller_spec.rb b/spec/controllers/api/experimental/queries_controller_spec.rb index 17715a0f4f..e98f31c0ce 100644 --- a/spec/controllers/api/experimental/queries_controller_spec.rb +++ b/spec/controllers/api/experimental/queries_controller_spec.rb @@ -44,7 +44,7 @@ describe Api::Experimental::QueriesController, :type => :controller do end shared_context 'expects policy to be followed' do |allowed_actions| - let(:called_with_expected_args) { { called: false } } + let(:called_with_expected_args) { [] } before do policy = double('QueryPolicy').as_null_object @@ -54,14 +54,14 @@ describe Api::Experimental::QueriesController, :type => :controller do if received_query.id == query.id && Array(allowed_actions).include?(received_action) - called_with_expected_args[:called] = true + called_with_expected_args << received_action end end.at_least(1).times.and_return(true) end after do - expect(called_with_expected_args[:called]).to be_truthy + expect(called_with_expected_args.uniq).to match_array(Array(allowed_actions)) end end