Sha256: 0f01dc7d846be22ff950f9e93f5909125cbc544e634d0f0f03cd213e78236924

Contents?: true

Size: 1.24 KB

Versions: 3

Compression:

Stored size: 1.24 KB

Contents

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'rspec'
require 'json'
require 'hashie'
require 'net/http'
require 'google_contacts_api'

puts "Testing version #{GoogleContactsApi::VERSION}"

# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
# Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}

RSpec.configure do |config|
  config.mock_framework = :rspec
end

def contact_set_json_from_file(filename)
  f = File.open(File.join(File.dirname(__FILE__), filename))
  json = f.read
  f.close
  json
end

def contact_set_json
  contact_set_json_from_file("contact_set.json")
end

def group_set_json
  contact_set_json_from_file("group_set.json")
end

def empty_contact_set_json
  contact_set_json_from_file("empty_contact_set.json")
end

def contact_json_hash
  Hashie::Mash.new(JSON.parse(contact_set_json)).feed.entry.first
end

def contact_no_emails_json_hash
  Hashie::Mash.new(JSON.parse(contact_set_json)).feed.entry[1]
end

def contact_no_primary_email_json_hash
  Hashie::Mash.new(JSON.parse(contact_set_json)).feed.entry[2]
end

def group_json_hash
  Hashie::Mash.new(JSON.parse(group_set_json)).feed.entry.first
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
google_contacts_api-0.3.2 spec/spec_helper.rb
google_contacts_api-0.3.1 spec/spec_helper.rb
google_contacts_api-0.3.0 spec/spec_helper.rb