spec/controllers/terms_controller_spec.rb in qa-0.4.3 vs spec/controllers/terms_controller_spec.rb in qa-0.5.0
- old
+ new
@@ -28,12 +28,12 @@
expect(response.code).to eq("404")
end
end
context "when a sub-authority does not exist" do
it "should return 404 if a sub-authority does not exist" do
- expect(Rails.logger).to receive(:warn).with("Unable to initialize sub-authority non-existent-subauthority for Qa::Authorities::Loc")
- get :search, { :q => "a query", :vocab => "loc", :sub_authority => "non-existent-subauthority" }
+ expect(Rails.logger).to receive(:warn).with("Unable to initialize sub-authority non-existent-subauthority for Qa::Authorities::Loc. Valid sub-authorities are [\"subjects\", \"names\", \"classification\", \"childrensSubjects\", \"genreForms\", \"performanceMediums\", \"graphicMaterials\", \"organizations\", \"relators\", \"countries\", \"ethnographicTerms\", \"geographicAreas\", \"languages\", \"iso639-1\", \"iso639-2\", \"iso639-5\", \"preservation\", \"actionsGranted\", \"agentType\", \"edtf\", \"contentLocationType\", \"copyrightStatus\", \"cryptographicHashFunctions\", \"environmentCharacteristic\", \"environmentPurpose\", \"eventRelatedAgentRole\", \"eventRelatedObjectRole\", \"eventType\", \"formatRegistryRole\", \"hardwareType\", \"inhibitorTarget\", \"inhibitorType\", \"objectCategory\", \"preservationLevelRole\", \"relationshipSubType\", \"relationshipType\", \"rightsBasis\", \"rightsRelatedAgentRole\", \"signatureEncoding\", \"signatureMethod\", \"softwareType\", \"storageMedium\"]")
+ get :search, { :q => "a query", :vocab => "loc", :subauthority => "non-existent-subauthority" }
expect(response.code).to eq("404")
end
end
context "when a sub-authority is absent" do
it "should return 404 for LOC" do
@@ -58,22 +58,22 @@
it "should return a set of terms for a tgnlang query" do
get :search, {:q => "Tibetan", :vocab => "tgnlang" }
expect(response).to be_success
end
- it "should not return 404 if sub_authority is valid" do
- get :search, { :q => "Berry", :vocab => "loc", :sub_authority => "names" }
+ it "should not return 404 if subauthority is valid" do
+ get :search, { :q => "Berry", :vocab => "loc", :subauthority => "names" }
expect(response).to be_success
end
end
describe "#index" do
context "with supported authorities" do
it "should return all local authority state terms" do
- get :index, { :vocab => "local", :sub_authority => "states" }
+ get :index, { :vocab => "local", :subauthority => "states" }
expect(response).to be_success
end
it "should return all MeSH terms" do
get :index, { :vocab => "mesh" }
expect(response).to be_success
@@ -84,15 +84,15 @@
it "should return null for tgnlang" do
get :index, { :vocab => "tgnlang" }
expect(response.body).to eq("null")
end
it "should return null for oclcts" do
- get :index, { :vocab => "oclcts", :sub_authority => "mesh" }
+ get :index, { :vocab => "oclcts", :subauthority => "mesh" }
expect(response.body).to eq("null")
end
it "should return null for LOC authorities" do
- get :index, { :vocab => "loc", :sub_authority => "relators" }
+ get :index, { :vocab => "loc", :subauthority => "relators" }
expect(response.body).to eq("null")
end
end
end
@@ -106,20 +106,20 @@
with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip, deflate', 'User-Agent'=>'Ruby'}).
to_return(:status => 200, :body => webmock_fixture("loc-names-response.txt"), :headers => {})
end
it "should return an individual state term" do
- get :show, { :vocab => "local", :sub_authority => "states", id: "OH" }
+ get :show, { :vocab => "local", :subauthority => "states", id: "OH" }
expect(response).to be_success
end
it "should return an individual MeSH term" do
get :show, { vocab: "mesh", id: "D000001" }
expect(response).to be_success
end
it "should return an individual subject term" do
- get :show, { vocab: "loc", sub_authority: "subjects", id: "sh85077565" }
+ get :show, { vocab: "loc", subauthority: "subjects", id: "sh85077565" }
expect(response).to be_success
end
end