Sha256: e153d109d7b5ecda5e5afd857cf3638c73cfaf62223d59b1dae28f04bd492cd8
Contents?: true
Size: 1.93 KB
Versions: 3
Compression:
Stored size: 1.93 KB
Contents
require 'core/spec_helper' require 'json' require 'uri' describe OSCRuby::AnalyticsReportResults do let(:client) { OSCRuby::Client.new do |config| config.interface = ENV['OSC_SITE'] config.username = ENV['OSC_ADMIN'] config.password = ENV['OSC_PASSWORD'] config.demo_site = true end } let(:last_updated){ OSCRuby::AnalyticsReportResults.new(lookupName: "Last Updated By Status") } let(:answers_search){ OSCRuby::AnalyticsReportResults.new(id: 176) } let(:error_example){ OSCRuby::AnalyticsReportResults.new } context "#initialize" do it "should expect an id or a lookupName for a report" do expect(last_updated).to be_an(OSCRuby::AnalyticsReportResults) expect(last_updated.lookupName).to eq("Last Updated By Status") expect(answers_search).to be_an(OSCRuby::AnalyticsReportResults) expect(answers_search.id).to eq(176) end end context "#run" do it 'should expect client is an instance of OSCRuby::Client class and raise an error if does not' do expect(client).to be_an(OSCRuby::Client) client = nil expect{answers_search.run(client)}.to raise_error('Client must have some configuration set; please create an instance of OSCRuby::Client with configuration settings') end it 'should throw an error if there is no id or no lookupName assigned',:vcr do expect{error_example.run(client)}.to raise_error('AnalyticsReportResults must have an id or lookupName set') error_example.id = 176 expect(error_example.run(client)).to be_an(Array) end it 'should be able to take filters', :vcr do keywords = arrf(name: "search_ex", values: "Maestro") answers_search.filters << keywords answers = answers_search.run(client) answers.each do |answer| expect(answer['Summary']).to be_a(String) expect(answer['Answer ID']).to be_a(Integer) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
osc_ruby-1.4.2 | spec/core/analytics_report_results_spec.rb |
osc_ruby-1.4.1 | spec/core/analytics_report_results_spec.rb |
osc_ruby-1.4.0 | spec/core/analytics_report_results_spec.rb |