Sha256: d9f98063414a1da398eb465e084ebb8366bba0b519fd9e960e0b1fcf4328b2ef

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

require 'spec_helper'

describe TedApi::Client::Themes do

  after(:each) do
    TedApi.reset
  end

  # JSON Tests:

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

Version data entries

1 entries across 1 versions & 1 rubygems

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