Sha256: ba0695948e9e50a23ac37107d4ead3b2a81133a058286298b33eccd8bbaf9e7f

Contents?: true

Size: 951 Bytes

Versions: 3

Compression:

Stored size: 951 Bytes

Contents

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

require 'spec_helper'

describe Crowdskout::Services::FieldService do
  before(:each) do
    @request = double('http request', :user => nil, :password => nil, :url => 'http://example.com', :redirection_history => nil)
  end

  describe "#get_options_for_a_field" do
    it "returns a field" do
      json = load_file('field_response.json')
      net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')

      response = RestClient::Response.create(json, net_http_resp, @request)
      RestClient.stub(:get).and_return(response)
      field = Crowdskout::Services::FieldService.new('api_key', 'access_token').get_options_for_a_field("AddressCity")

      field.should be_kind_of(Crowdskout::Components::FieldOptions)
      field.collection.should eq "PhysicalAddresses"
      field.options[0].value.should eq "Lisbon"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
crowdskout-0.1.5 spec/crowdskout/services/field_service_spec.rb
crowdskout-0.1.4 spec/crowdskout/services/field_service_spec.rb
crowdskout-0.1.3 spec/crowdskout/services/field_service_spec.rb