spec/models/admin_set_spec.rb in ddr-models-2.4.11 vs spec/models/admin_set_spec.rb in ddr-models-2.4.12
- old
+ new
@@ -32,9 +32,22 @@
expect(described_class.call(obj)).to be_nil
end
end
end
+ describe ".keys" do
+ let(:entries) { [ described_class.new(id: 1, code: 'dvs', title: 'D and V S Department'),
+ described_class.new(id: 2, code: 'abc', title: 'ABC Department') ] }
+ let(:response_collection) { ActiveResource::Collection.new }
+ before do
+ response_collection.elements = entries
+ allow(described_class).to receive(:all) { response_collection }
+ end
+ it "returns the defined codes" do
+ expect(described_class.keys).to match_array([ entries[0].code, entries[1].code ])
+ end
+ end
+
describe "instance methods" do
subject { described_class.new("id"=>1, "code"=>"dvs", "title"=>"Data and Visualization Services", "created_at"=>"2015-09-15T16:15:58.514Z", "updated_at"=>"2015-09-15T16:15:58.514Z") }
its(:to_s) { is_expected.to eq("Data and Visualization Services") }
end