Sha256: 970bd337c1f9cd6945ceef2a213a22833465d1f7d3a7aa5c29a65f02588e29e0

Contents?: true

Size: 1.64 KB

Versions: 17

Compression:

Stored size: 1.64 KB

Contents

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

describe Octokit::Repository do
  context "when passed a string containg a slash" do
    before do
      @repository = Octokit::Repository.new("sferik/octokit")
    end

    it "should set the repository name and username" do
      @repository.name.should == "octokit"
      @repository.username.should == "sferik"
    end

    it "should respond to repo and user" do
      @repository.repo.should == "octokit"
      @repository.user.should == "sferik"
    end

    it "should render slug as string" do
      @repository.slug.should == "sferik/octokit"
      @repository.to_s.should == @repository.slug
    end

    it "should render url as string" do
      @repository.url.should == 'https://github.com/sferik/octokit'
    end

  end

  context "when passed a hash" do
    it "should set the repository name and username" do
      repository = Octokit::Repository.new({:username => 'sferik', :name => 'octokit'})
      repository.name.should == "octokit"
      repository.username.should == "sferik"
    end
  end

  context "when passed a Repo" do
    it "should set the repository name and username" do
      repository = Octokit::Repository.new(Octokit::Repository.new('sferik/octokit'))
      repository.name.should == "octokit"
      repository.username.should == "sferik"
      repository.url.should == 'https://github.com/sferik/octokit'
    end
  end

  context "when given a URL" do
    it "should set the repository name and username" do
      repository = Octokit::Repository.from_url("https://github.com/sferik/octokit")
      repository.name.should == "octokit"
      repository.username.should == "sferik"
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
octokit-1.17.0 spec/repository_spec.rb
octokit-1.15.1 spec/repository_spec.rb
octokit-1.15.0 spec/repository_spec.rb
octokit-1.14.0 spec/repository_spec.rb
octokit-1.13.0 spec/repository_spec.rb
octokit-1.12.0 spec/repository_spec.rb
octokit-1.11.0 spec/repository_spec.rb
octokit-1.10.0 spec/repository_spec.rb
octokit-1.9.4 spec/repository_spec.rb
octokit-1.9.3 spec/repository_spec.rb
octokit-1.9.2 spec/repository_spec.rb
octokit-1.9.1 spec/repository_spec.rb
octokit-1.8.1 spec/repository_spec.rb
octokit-1.8.0 spec/repository_spec.rb
octokit-1.7.0 spec/repository_spec.rb
octokit-1.6.1 spec/repository_spec.rb
octokit-1.6.0 spec/repository_spec.rb