Sha256: 06606ec191294995eb06c72b786b0c79b225593c1448f03ea516a1da990c373e

Contents?: true

Size: 999 Bytes

Versions: 24

Compression:

Stored size: 999 Bytes

Contents

# -*- encoding: utf-8 -*-
require 'helper'

describe Octokit::Gist do

  context "when given a URL" do
    it "should set the id" do
      gist = Octokit::Gist.from_url("https://gist.github.com/12345")
      gist.id.should == '12345'
    end
  end

  context "when passed a string ID" do
    before do
      @gist = Octokit::Gist.new('12345')
    end

    it "should set the gist ID" do
      @gist.id.should == '12345'
    end

    it "should set the url" do
      @gist.url.should == 'https://gist.github.com/12345'
    end

    it "should render id as string" do
      @gist.to_s.should == @gist.id
    end
  end

  context "when passed a Fixnum ID" do
    before do
      @gist = Octokit::Gist.new(12345)
    end

    it "should set the gist ID as a string" do
      @gist.id.should == '12345'
    end

    it "should set the url" do
      @gist.url.should == 'https://gist.github.com/12345'
    end

    it "should render id as string" do
      @gist.to_s.should == @gist.id
    end
  end

end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
octokit-1.2.1 spec/octokit/gist_spec.rb
octokit-1.2.0 spec/octokit/gist_spec.rb
octokit-1.1.1 spec/octokit/gist_spec.rb
octokit-1.1.0 spec/octokit/gist_spec.rb