Sha256: 37dbb7ff1b3833bd394ae515a7e86b993799416c7c0a25a0e0ad5b0118a4cec6
Contents?: true
Size: 1.53 KB
Versions: 2
Compression:
Stored size: 1.53 KB
Contents
# Copyright © 2012 The Pennsylvania State University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require 'spec_helper' describe AuthoritiesController do describe "#query" do it "should return an array of hashes" do mock_hits = [{:label => "English", :uri => "http://example.org/eng"}, {:label => "Environment", :uri => "http://example.org/env"}, {:label => "Edge", :uri => "http://example.org/edge"}, {:label => "Edgar", :uri => "http://example.org/edga"}, {:label => "Eddie", :uri => "http://example.org/edd"}, {:label => "Economics", :uri => "http://example.org/eco"}] LocalAuthority.expects(:entries_by_term).returns(mock_hits) xhr :get, :query, :model=>"generic_files", :term=>"subject", :q=>"E" response.should be_success JSON.parse(response.body).count.should == 6 JSON.parse(response.body)[0]["label"].should == "English" JSON.parse(response.body)[0]["uri"].should == "http://example.org/eng" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sufia-0.0.1.pre2 | spec/controllers/authorities_controller_spec.rb |
sufia-0.0.1.pre1 | spec/controllers/authorities_controller_spec.rb |