Sha256: f18d4cc3f3ab137f815f9a1d9ce780d8c5825a184772ceb4f3777c44cd531ce5

Contents?: true

Size: 1.2 KB

Versions: 3

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'
require 'git/pr/git_properties'

describe Git::Pr::GitProperties do
  let(:git) { Git::Pr::GitProperties.new }

  describe '#api_token' do
    it 'returns the user`s GitHub API token' do
      git.stub(:`).with(/github.token/).and_return('foo')

      expect(git.api_token).to eq 'foo'
    end
  end

  describe '#current_branch' do
    it 'returns the name of the current branch' do
      git.stub(:`).with(/symbolic-ref/).and_return('refs/heads/foo')

      expect(git.current_branch).to eq 'foo'
    end
  end

  describe '#repository' do
    it 'returns the name of the GitHub repository' do
      git.stub(:`).with(/remote.origin.url/).and_return('git@github.com:foo/bar.git')

      expect(git.repository).to eq 'foo/bar'
    end
  end

  describe '#login' do
    it 'returns the user`s GitHub login name' do
      git.stub(:`).with(/github.user/).and_return('foo')

      expect(git.login).to eq 'foo'
    end
  end

  describe '#repository_profile' do
    it 'returns an array of repositories in the given profile' do
      git.stub(:`).with(/pr.repository_profile.foo/).and_return("repo/one\nrepo/two\n")

      expect(git.repository_profile('foo')).to eq ['repo/one', 'repo/two']
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
git-pr-0.0.4 spec/git/pr/git_properties_spec.rb
git-pr-0.0.3 spec/git/pr/git_properties_spec.rb
git-pr-0.0.2 spec/git/pr/git_properties_spec.rb