Sha256: 904a5c8e778a5f8524f160e01ca1ec9dfcefb644bd85b914f9f862831c57358b
Contents?: true
Size: 1 KB
Versions: 1
Compression:
Stored size: 1 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../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.should_receive(:entries_by_term).and_return(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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sufia-3.0.0 | spec/controllers/authorities_controller_spec.rb |