Sha256: cfb9abbf24b0cd5e45073315f62a82b277b5e7b400a110a4433002991e2d9b07

Contents?: true

Size: 784 Bytes

Versions: 2

Compression:

Stored size: 784 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe Zelda::Request do
  it "should call HTTParty" do
    HTTParty.should_receive(:get).with("http://zelda.omroep.nl/12345/foo")
    Zelda::Request.get('foo')
  end

  it "should raise an error without an API key" do
    api_key = Zelda.send(:remove_const, :API_KEY)
    lambda { Zelda::Request.get('foo') }.should raise_error("No Zelda::API_KEY specified")
    Zelda::API_KEY = api_key
  end
  
  describe "when returning an url" do
    it "should be correct with 1 args" do
      Zelda::Request.parse_url('foo').should == "http://zelda.omroep.nl/12345/foo" 
    end
    
    it "should be correct with 2 args" do
      Zelda::Request.parse_url('foo', 'bar').should == "http://zelda.omroep.nl/12345/foo/bar" 
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bartzon-zelda-0.0.2 spec/zelda/request_spec.rb
bartzon-zelda-0.0.3 spec/zelda/request_spec.rb