Sha256: 7e2bbb9fd10e800cb97ea322e96ae84606fc794469b598e9fa4700c32cdb1720

Contents?: true

Size: 1.52 KB

Versions: 8

Compression:

Stored size: 1.52 KB

Contents

require "rspec"
require "rspec_helper"
require "fileutils"

describe "RepoServer" do

	testFolder = nil
	before do
		testFolder = Dir.mktmpdir('Repo_spec-')

		cred = Credentials.new(:designshell)

	end

	after do
		FileUtils.rm_rf testFolder if testFolder
	end

	it "should list repos" do
		keyChain = DesignShell::KeyChain.new('DesignShell')
		#keyChain.set({
		#	:oauth_token => 'OAuth consumer Key',
		#	:oauth_secret => 'OAuth consumer Secret',
		#  :login => 'username, not email address',
		#  :password => 'user password'
		#},'RepoServer.')
		repoServer = DesignShell::RepoServer.new
		# should move values to credentials that looks up keyChain
		values = keyChain.get([:oauth_token,:oauth_secret,:login,:password],'RepoServer.').symbolize_keys
		repoServer.setup(values)

		result = repoServer.repos    #"[#<Hashie::Mash is_private=true name="test1" owner="buzzware" scm="git" slug="test1">]"
		result.class.should==Array
		result.length.should > 0
		result.first.scm.should=='git'
	end

	it "should clone the first repo" do
		keyChain = DesignShell::KeyChain.new('DesignShell')
		repoServer = DesignShell::RepoServer.new
		values = keyChain.get([:oauth_token,:oauth_secret,:login,:password],'RepoServer.').symbolize_keys
		repoServer.setup(values)
		repos = repoServer.repos
		repos.length.should > 0
		repo = repos && repos.first

		url = "git@bitbucket.org:#{repo.owner}/#{repo.slug}.git"
		repo = DesignShell::Repo.new
		result = repo.clone(url, testFolder)
		repo.path.should == testFolder
		repo.branches.class.should == Git::Branches
	end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
designshell-0.0.8 spec/RepoServer_spec.rb
designshell-0.0.7 spec/RepoServer_spec.rb
designshell-0.0.6 spec/RepoServer_spec.rb
designshell-0.0.5 spec/RepoServer_spec.rb
designshell-0.0.4 spec/RepoServer_spec.rb
designshell-0.0.3 spec/RepoServer_spec.rb
designshell-0.0.2 spec/RepoServer_spec.rb
designshell-0.0.1 spec/RepoServer_spec.rb