Sha256: 4039dc55776b80d0b6ebf28ac52506a639ca766215ed264974f3471e99900cbd

Contents?: true

Size: 1.39 KB

Versions: 1

Compression:

Stored size: 1.39 KB

Contents

require 'spec_helper'

describe TedApi::Client::RatingWords do

  after(:each) do
    TedApi.reset
  end

  # JSON Tests:

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

Version data entries

1 entries across 1 versions & 1 rubygems

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