Sha256: 757200ee68120a20201193d1928cc1cd2c87a5d525f1334857a8141e47b38c02

Contents?: true

Size: 1.36 KB

Versions: 2

Compression:

Stored size: 1.36 KB

Contents

require 'spec_helper'

describe Zoomus::Actions::Report do
	before :all do
		@zc = zoomus_client
		@args = { year: 2017, month: 7 }
	end

	describe '#report_getdailyreport action' do
		before :each do
			stub_request(
				:post,
				zoomus_url('/report/getdailyreport')
			).to_return(:body => json_response('report_getdailyreport'))
		end

		it "requires a 'year' argument" do
			expect {
				@zc.report_getdailyreport(filter_key(@args, :year))
			}.to raise_error(ArgumentError)
		end

		it "requires a 'month' argument" do
			expect {
				@zc.report_getdailyreport(filter_key(@args, :month))
			}.to raise_error(ArgumentError)
		end

		it "returs a Hash" do
			expect(@zc.report_getdailyreport(@args)).to be_kind_of(Hash)
		end

		it "returns a 'year'" do
			expect(@zc.report_getdailyreport(@args)['year']).to eq(@args[:year])
		end

		it "returns a 'month'" do
			expect(@zc.report_getdailyreport(@args)['month']).to eq(@args[:month])
		end

		it "returns a 'dates' Array" do
			expect(@zc.report_getdailyreport(@args)['dates']).to be_kind_of(Array)
		end
	end

	describe "#report_getdailyreport! action" do
		before :each do
			stub_request(
				:post,
				zoomus_url("/report/getdailyreport")
			).to_return(:body => json_response("error"))
		end

		it "raises Zoomus::Error exception" do
			expect {
				@zc.report_getdailyreport!(@args)
			}.to raise_error(Zoomus::Error)
		end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
zoomus-0.7.0 spec/lib/zoomus/actions/report/getdailyreport_spec.rb
zoomus-0.6.0 spec/lib/zoomus/actions/report/getdailyreport_spec.rb