Sha256: 81e89b9e32dd21cfc12625b52184220c9beb71a788f060d532f8b7346268d6d6

Contents?: true

Size: 992 Bytes

Versions: 20

Compression:

Stored size: 992 Bytes

Contents

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

describe Octokit::Gist do

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

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

    it "sets the gist ID" do
      expect(@gist.id).to eq('12345')
    end

    it "sets the url" do
      expect(@gist.url).to eq('https://gist.github.com/12345')
    end

    it "renders id as string" do
      expect(@gist.to_s).to eq(@gist.id)
    end
  end

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

    it "sets the gist ID as a string" do
      expect(@gist.id).to eq('12345')
    end

    it "sets the url" do
      expect(@gist.url).to eq('https://gist.github.com/12345')
    end

    it "renders id as string" do
      expect(@gist.to_s).to eq(@gist.id)
    end
  end

end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
octokit-2.3.0 spec/octokit/gist_spec.rb
octokit-2.2.0 spec/octokit/gist_spec.rb
octokit-2.1.2 spec/octokit/gist_spec.rb
octokit-2.1.1 spec/octokit/gist_spec.rb
octokit-2.1.0 spec/octokit/gist_spec.rb
octokit-2.0.0 spec/octokit/gist_spec.rb
octokit-2.0.0.rc4 spec/octokit/gist_spec.rb
octokit-2.0.0.rc3 spec/octokit/gist_spec.rb
octokit-2.0.0.rc2 spec/octokit/gist_spec.rb
octokit-2.0.0.rc1 spec/octokit/gist_spec.rb
octokit-2.0.0.pre spec/octokit/gist_spec.rb
octokit-1.25.0 spec/octokit/gist_spec.rb
octokit-1.24.0 spec/octokit/gist_spec.rb
octokit-1.23.0 spec/octokit/gist_spec.rb
octokit-1.22.0 spec/octokit/gist_spec.rb
octokit-1.21.0 spec/octokit/gist_spec.rb
octokit-1.20.0 spec/octokit/gist_spec.rb
octokit-1.19.0 spec/octokit/gist_spec.rb
octokit-1.18.0 spec/octokit/gist_spec.rb
octokit-1.17.1 spec/octokit/gist_spec.rb