Sha256: e9d9bcafe9e7a61c17c1a83ae34c68903f90a1cf82f3a23b49a1982d0488de3e

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

describe TedApi::Client::Languages do

  after(:each) do
    TedApi.reset
  end

  # JSON Tests:

  it "should list Ted events in json" do
    @client = TedApi::Client.new(api_key: 'foo')
    stub_get("languages.json?api-key=foo").
      to_return(:body => fixture("languages.json"))
    response = @client.languages
    response.languages.first.language.language_code.should == 'af'
  end 
  
  it "should return a specific Ted event in json" do
    @client = TedApi::Client.new(api_key: 'foo')
    stub_get("languages/af.json?api-key=foo").
      to_return(:body => fixture("language.json"))
    response = @client.languages('af')
    response.language.language_code.should == 'af'
  end 
  
  # XML Tests:
  
  it "should list Ted events in xml" do
    @client = TedApi::Client.new(api_key: 'foo', response_format: 'xml')
    stub_get("languages.xml?api-key=foo").
      to_return(:body => fixture("languages.xml"))
    response = @client.languages
    response.languages.first.first.should == 'language'
  end
  
  it "should return a specific Ted event in xml" do
    @client = TedApi::Client.new(api_key: 'foo', response_format: 'xml')
    stub_get("languages/af.xml?api-key=foo").
      to_return(:body => fixture("language.xml"))
    response = @client.languages('af')
    response.language.language_code.should == 'af'
  end
  
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ted_api-0.1 spec/ted_api/client/languages_spec.rb