summaryrefslogtreecommitdiff
path: root/qa/spec/resource/events/base_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'qa/spec/resource/events/base_spec.rb')
-rw-r--r--qa/spec/resource/events/base_spec.rb29
1 files changed, 29 insertions, 0 deletions
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