Sha256: befa280499d200c11cbd9f6ac07aeb9b3a69d9021a5a4ed777ad0d71b0170286

Contents?: true

Size: 969 Bytes

Versions: 14

Compression:

Stored size: 969 Bytes

Contents

#
# field_options_spec.rb
# Crowdskout
#
# Copyright (c) 2016 Kyle Schutt. All rights reserved.require 'spec_helper'

require 'spec_helper'

describe Crowdskout::Components::FieldOptions do
  before do 
    @json_string = %[{
                        "collection" : "PhysicalAddresses",
                        "options" : [
                            {
                              "id" : 1,
                              "value" : "Lisbon"
                            }
                          ]
                      }]
    @hash = JSON.parse(@json_string)
  end

  it "creates a field option" do
    field_option = Crowdskout::Components::FieldOptions.create(@hash)
    expect(field_option.collection).to eq "PhysicalAddresses"
    expect(field_option.options.count).to eq 1
  end
  it "generates the correct json object" do 
    field_option = Crowdskout::Components::FieldOptions.create(@hash)
    expect(JSON.parse(field_option.to_json)).to eq @hash
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
crowdskout-0.1.5 spec/crowdskout/components/fields/field_options_spec.rb
crowdskout-0.1.4 spec/crowdskout/components/fields/field_options_spec.rb
crowdskout-0.1.3 spec/crowdskout/components/fields/field_options_spec.rb
crowdskout-0.1.2 spec/crowdskout/components/fields/field_options_spec.rb
crowdskout-0.1.1 spec/crowdskout/components/fields/field_options_spec.rb
crowdskout-0.1.0 spec/crowdskout/components/fields/field_options_spec.rb
crowdskout-0.0.20 spec/crowdskout/components/fields/field_options_spec.rb
crowdskout-0.0.19 spec/crowdskout/components/fields/field_options_spec.rb
crowdskout-0.0.13 spec/crowdskout/components/fields/field_options_spec.rb
crowdskout-0.0.10 spec/crowdskout/components/fields/field_options_spec.rb
crowdskout-0.0.9 spec/crowdskout/components/fields/field_options_spec.rb
crowdskout-0.0.8 spec/crowdskout/components/fields/field_options_spec.rb
crowdskout-0.0.7 spec/crowdskout/components/fields/field_options_spec.rb
crowdskout-0.0.6 spec/crowdskout/components/fields/field_options_spec.rb