Sha256: e85dd7a10c893059ff8f299f7b26a003ff4e68d03a98faa32a37f846fd5faa18

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/helper')

class RepoTest < Test::Unit::TestCase
  context "when passed a string containg a forward slash" do
    setup do
      @repo = Octokit::Repository.new("pengwynn/linkedin")
    end

    should "set the username and repo name" do
      @repo.name.should == "linkedin"
      @repo.username.should == "pengwynn"
    end

    should "repond to user and repo" do
      @repo.repo.should == "linkedin"
      @repo.user.should == "pengwynn"
    end

    should "render slug as string" do
      @repo.slug.should == "pengwynn/linkedin"
      @repo.to_s.should == @repo.slug
    end

    should "render url as string" do
      @repo.url.should == 'https://github.com/pengwynn/linkedin'
    end

  end

  context "when passed a hash" do
    should "should set username and repo" do
      repo =  Octokit::Repository.new({:username => 'pengwynn', :name => 'linkedin'})
      repo.name.should == "linkedin"
      repo.username.should == "pengwynn"
    end
  end

  context "when passed a Repo" do
    should "set username and repo" do
      repo =  Octokit::Repository.new(Octokit::Repository.new('pengwynn/linkedin'))
      repo.name.should == "linkedin"
      repo.username.should == "pengwynn"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
octokit-0.4.0 test/repository_test.rb