From 97265d39e72cbb32468a3f1d671820528af02a8b Mon Sep 17 00:00:00 2001 From: Mark Lapierre Date: Mon, 11 Feb 2019 09:04:59 +0000 Subject: [CE] Improve `wait_for_push` --- qa/spec/resource/events/base_spec.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 qa/spec/resource/events/base_spec.rb (limited to 'qa/spec/resource/events/base_spec.rb') diff --git a/qa/spec/resource/events/base_spec.rb b/qa/spec/resource/events/base_spec.rb new file mode 100644 index 00000000000..9cdf4785092 --- /dev/null +++ b/qa/spec/resource/events/base_spec.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +describe QA::Resource::Events::Base do + let(:resource) do + Class.new(QA::Resource::Base) do + def api_get_path + '/foo' + end + end + end + + subject { resource.tap { |f| f.include(described_class) }.new } + + describe "#events" do + it 'fetches all events when called without parameters' do + allow(subject).to receive(:parse_body).and_return('returned') + + expect(subject).to receive(:api_get_from).with('/foo/events') + expect(subject.events).to eq('returned') + end + + it 'fetches events with a specified action type' do + allow(subject).to receive(:parse_body).and_return('returned') + + expect(subject).to receive(:api_get_from).with('/foo/events?action=pushed') + expect(subject.events(action: 'pushed')).to eq('returned') + end + end +end -- cgit v1.2.1