Sha256: 12459bb56e7858386b1fb976c285a82e4847250f43fe252a16e54ed116b9f87f
Contents?: true
Size: 1.4 KB
Versions: 14
Compression:
Stored size: 1.4 KB
Contents
# # collection_spec.rb # Crowdskout # # Copyright (c) 2016 Kyle Schutt. All rights reserved.require 'spec_helper' require 'spec_helper' describe Crowdskout::Components::Collection do before do @json_string = %[{ "Names" : [ { "id" : 1, "FullName" : "Mr. Ferdinand Magellan", "NameTitle" : "Mr.", "FirstName" : "Ferdinand", "MiddleName" : "", "LastName" : "Magellan", "NameSuffix" : "", "Gender" : { "id" : 1, "value" : "Male" } } ] }] @hash = JSON.parse(@json_string) end it "creates a component" do component = Crowdskout::Components::Collection.create(@hash) expect(component.key_name).to eq "Names" expect(component.items.count).to eq 1 component.items[0].should be_kind_of(Crowdskout::Components::Item) expect(component.items[0].fields.count).to eq 7 end it "generates the correct json object" do component = Crowdskout::Components::Collection.create(@hash) expect(JSON.parse(component.to_json)).to eq @hash end end
Version data entries
14 entries across 14 versions & 1 rubygems