File: search_query_spec.rb

package info (click to toggle)
ruby-roxml 4.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 800 kB
  • sloc: ruby: 4,133; xml: 1,013; makefile: 7
file content (26 lines) | stat: -rw-r--r-- 740 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
require 'spec_helper'
require_relative './../../examples/search_query'

describe SearchQuery do	

	before do
		@search = SearchQuery.new
		@search.query = 'This is a random search query.'

		@saved_search = SearchQuery.from_xml("<searchquery><query>Search for something</query></searchquery>")
	end

	it 'should return the default value for all attributes where no value is set' do
		expect(@search.language).to eq('EN')
		@search.max_results == 20
	end

	it 'should return the same object for the default value' do
		expect(@search.language.object_id).to eq(@search.language.object_id)
	end

	it 'should respect the defaults when loading from xml' do
		expect(@saved_search.language).to eq('EN')
		@saved_search.max_results == 20
	end
end