Sha256: b13ba6b0faa63757931551669b62382f8f58605e969dbf55fd2258c8e5a52c29

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

describe TedApi::Client::Tags do

  after(:each) do
    TedApi.reset
  end

  # JSON Tests:

  it "should list tags in json" do
    @client = TedApi::Client.new(api_key: 'foo')
    stub_get("tags.json?api-key=foo").
      to_return(:body => fixture("tags.json"))
    response = @client.tags
    response.tags.first.tag.name.should == 'standard'
  end 
  
  it "should return a specific tag in json" do
    @client = TedApi::Client.new(api_key: 'foo')
    stub_get("tags/1.json?api-key=foo").
      to_return(:body => fixture("tag.json"))
    response = @client.tags('1')
    response.tag.name.should == 'standard'
  end 
  
  # XML Tests:
  
  it "should list speakers in xml" do
    @client = TedApi::Client.new(api_key: 'foo', response_format: 'xml')
    stub_get("tags.xml?api-key=foo").
      to_return(:body => fixture("tags.xml"))
    response = @client.tags
    response.tags.first.first.should == 'tag'
  end
  
  it "should return a specific theme in xml" do
    @client = TedApi::Client.new(api_key: 'foo', response_format: 'xml')
    stub_get("tags/1.xml?api-key=foo").
      to_return(:body => fixture("tag.xml"))
    response = @client.tags('1')
    response.tag.name.should == 'standard'
  end
  
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

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