Sha256: 7bbd6b73ddaba44a070231e1413c97ac80bf131bb4041ffbb137d4a83342ae2a

Contents?: true

Size: 1014 Bytes

Versions: 11

Compression:

Stored size: 1014 Bytes

Contents

require 'spec_helper'

module GitObjectBrowser
  describe Main do
    subject { Main.new }

    describe '#find_target' do
      it 'return git directory under the current directory' do
        dir = subject.find_target(File.join(FIXTURES_DIR, 'worktree'), '_git')
        dir.should match %r{/spec/fixtures/worktree/_git\z}
      end

      it 'return git directory under the parent directory' do
        dir = subject.find_target(File.join(FIXTURES_DIR, 'worktree/subdir'), '_git')
        dir.should match %r{/spec/fixtures/worktree/_git\z}
      end

      it 'return current git directory' do
        dir = subject.find_target(File.join(FIXTURES_DIR, 'worktree/_git'), '_git')
        dir.should match %r{/spec/fixtures/worktree/_git\z}
      end

      it 'use current directory if no arguments' do
        Dir.chdir(File.join(FIXTURES_DIR, 'worktree')) do
          dir = subject.find_target(nil, '_git')
          dir.should match %r{/spec/fixtures/worktree/_git\z}
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
git-object-browser-0.1.3 spec/git-object-browser/main_spec.rb
git-object-browser-0.1.2 spec/git-object-browser/main_spec.rb
git-object-browser-0.1.1 spec/git-object-browser/main_spec.rb
git-object-browser-0.1.0 spec/git-object-browser/main_spec.rb
git-object-browser-0.0.9 spec/git-object-browser/main_spec.rb
git-object-browser-0.0.8 spec/git-object-browser/main_spec.rb
git-object-browser-0.0.7 spec/git-object-browser/main_spec.rb
git-object-browser-0.0.6 spec/git-object-browser/main_spec.rb
git-object-browser-0.0.4 spec/git-object-browser/main_spec.rb
git-object-browser-0.0.3 spec/git-object-browser/main_spec.rb
git-object-browser-0.0.2 spec/git-object-browser/main_spec.rb