Sha256: cb5062e392f54c52435ebe1ec9919b8efa26dc21418ce3b219e38847bca8d7f7

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe Pixy::Shorten do
  context "when a new short url requested" do
    it { Pixy.should respond_to(:shorten!) }
    it { Pixy.should respond_to(:shorten) }

    context "without arguments" do
      it "should raise a required API key error" do
        lambda { Pixy.shorten! }.should raise_error(ArgumentError, "API key is required")
      end
    end

    context "with arguments" do
      subject { Pixy.shorten!('API_KEY', 'https://github.com/narkoz/pixy') }

      describe "#status" do
        it "should return a response status" do
          subject.status.should == 'ok'
        end
      end

      describe "#long_url" do
        it "should return a long url" do
          subject.long_url.should == 'https://github.com/narkoz/pixy'
        end
      end

      describe "#short_url" do
        it "should return a short url" do
          subject.short_url.should == 'http://p.tl/Us9R'
        end
      end

      describe "#counter" do
        it "should return a request number" do
          subject.counter.should == 12
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pixy-0.0.2 spec/pixy/shorten_spec.rb