Chris@16: require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') Chris@16: Chris@16: describe Checkout::Protocol do Chris@16: fixtures :settings, :repositories, :projects, :enabled_modules Chris@16: Chris@16: before(:each) do Chris@16: @admin = User.new Chris@16: @admin.admin = true Chris@16: @user = User.new Chris@16: Chris@16: @repo = repositories :svn Chris@16: @repo.url = "http://example.com/svn/testrepo" Chris@16: end Chris@16: Chris@16: it "should use regexes for generated URL" do Chris@16: protocol = @repo.checkout_protocols.find{|r| r.protocol == "SVN+SSH"} Chris@16: protocol.url.should eql "svn+ssh://testrepo@svn.foo.bar/svn" Chris@16: end Chris@16: Chris@16: it "should resolve access properties" do Chris@16: protocol = @repo.checkout_protocols.find{|r| r.protocol == "Subversion"} Chris@16: protocol.access.should eql "permission" Chris@16: protocol.access_rw(@admin).should eql "read+write" Chris@16: Chris@16: User.current = @user Chris@16: protocol.access_rw(@user).should eql "read-only" Chris@16: end Chris@16: Chris@16: it "should display the checkout command" do Chris@16: subversion = @repo.checkout_protocols.find{|r| r.protocol == "Subversion"} Chris@16: svn_ssh = @repo.checkout_protocols.find{|r| r.protocol == "SVN+SSH"} Chris@16: Chris@16: subversion.command.should eql "svn checkout" Chris@16: svn_ssh.command.should eql "svn co" Chris@16: end Chris@16: end