Sha256: bf27a5263e2f61a27e3d91a451ff14e2c963a4dd83b86fea29e09ba698b7f02f

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

require 'core/spec_helper'
require 'json'
require 'uri'

describe OSCRuby::QueryResults do

	let(:client) { 

		OSCRuby::Client.new do |config|
		
			config.interface = ENV['OSC_TEST_SITE']
		
			config.username = ENV['OSC_ADMIN']
		
			config.password = ENV['OSC_PASSWORD']
		
		end
	}

	let(:query_results){
		OSCRuby::QueryResults.new
	}

	context "#select" 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{query_results.select(client,'describe')}.to raise_error('Client must have some configuration set; please create an instance of OSCRuby::Client with configuration settings')

		end

		it 'should expect a query' do

			expect(client).to be_an(OSCRuby::Client)

			expect{query_results.select(client,"")}.to raise_error("A query must be specified when using the 'select' method")

		end

		it 'should put results in array of hashes',:vcr do 

			expect(query_results.select(client,"describe")).to eq(nil)

			expect(query_results.select(client,"describe answers")).to eq(nil)

			expect(query_results.select(client,"describe answers;describe servicecategories")).to eq(nil)

		end
		
	end

end	

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
osc_ruby-0.5.0 spec/core/query_results_spec.rb