Sha256: e344962d4febdc20a0d7d5711c5471947f23715421c94e3e9c91c3c15ebcea85

Contents?: true

Size: 780 Bytes

Versions: 2

Compression:

Stored size: 780 Bytes

Contents

require 'spec_helper'

describe Pixy do
  it { should respond_to :shorten }
  it { should respond_to :shorten! }
  it { should respond_to :stats }

  describe "#shorten" do
    context "without arguments" do
      it "should raise a required API key error" do
        expect { Pixy.shorten }.to raise_error(Pixy::MissingApiKey, "API key is required")
      end
    end

    context "with arguments" do
      it "should return an instance of Pixy::Shorten" do
        pixy = Pixy.shorten('API_KEY', 'https://github.com/narkoz/pixy')
        pixy.should be_a_kind_of Pixy::Shorten
      end
    end
  end

  describe "#shorten!" do
    it "should return a short url" do
      Pixy.shorten!('API_KEY', 'https://github.com/narkoz/pixy').should == 'http://p.tl/Us9R'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pixy-0.1.3 spec/pixy_spec.rb
pixy-0.1.2 spec/pixy_spec.rb