Skip to content

Commit

Permalink
Fixed a bug in the collection management record JSON schema, and adde…
Browse files Browse the repository at this point in the history
…d a test to catch it.
  • Loading branch information
marktriggs committed Dec 12, 2012
1 parent 67f55e8 commit d69fd53
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
13 changes: 4 additions & 9 deletions backend/spec/controller_collection_management_record_spec.rb
Expand Up @@ -3,17 +3,12 @@

describe 'Collection Management Record controller' do

it "paginates record listings" do
10.times { create(:json_collection_management) }
it "can create a collection management record" do
digital_object = create(:json_digital_object)

page1_ids = JSONModel(:collection_management).all(:page => 1, :page_size => 5)['results'].map {|obj| obj.id}
page2_ids = JSONModel(:collection_management).all(:page => 2, :page_size => 5)['results'].map {|obj| obj.id}
cm = create(:json_collection_management, :linked_records => [{:ref => digital_object.uri, :other_junk => "dropped"}])

page1_ids.length.should eq(5)
page2_ids.length.should eq(5)

# No overlaps between the contents of our two pages
(page1_ids - page2_ids).length.should eq(5)
cm.should_not be(nil)
end

end
10 changes: 6 additions & 4 deletions common/schemas/collection_management.rb
Expand Up @@ -23,10 +23,12 @@
"minItems" => 1,
"items" => {
"type" => "object",
"ref" => {"type" => [{"type" => "JSONModel(:accession) uri"},
{"type" => "JSONModel(:resource) uri"},
{"type" => "JSONModel(:digital_object) uri"}],
"ifmissing" => "error"}
"properties" => {
"ref" => {"type" => [{"type" => "JSONModel(:accession) uri"},
{"type" => "JSONModel(:resource) uri"},
{"type" => "JSONModel(:digital_object) uri"}],
"ifmissing" => "error"}
}
}
}
},
Expand Down

0 comments on commit d69fd53

Please sign in to comment.