Sha256: 75c76cae58de0e6dcbc8f02322dd5f88695a03a61805fc8874c7e341bcd4ae91

Contents?: true

Size: 1.4 KB

Versions: 24

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper'

describe 'Hg::Validation' do
  describe 'validate_server_connection' do
    it 'must handle non existent remote source' do
      core = OhlohScm::Factory.get_core(scm_type: :hg, url: 'http://www.selenic.com/repo/foobar')
      core.validate
      core.errors.wont_be :empty?
    end
  end

  describe 'validate url' do
    it 'must have errors for invalid urls' do
      assert_url_error(:hg, nil, '', 'foo', 'http:/', 'http:://', 'http://', 'http://a')
      assert_url_error(:hg, 'www.selenic.com/repo/hello') # missing a protool prefix
      assert_url_error(:hg, 'http://www.selenic.com/repo/hello%20world') # no encoded strings allowed
      assert_url_error(:hg, 'http://www.selenic.com/repo/hello world') # no spaces allowed
      assert_url_error(:hg, 'git://www.selenic.com/repo/hello') # git protocol not allowed
      assert_url_error(:hg, 'svn://www.selenic.com/repo/hello') # svn protocol not allowed
      assert_url_error(:hg, '/home/robin/hg')
      assert_url_error(:hg, 'file:///home/robin/hg')
      assert_url_error(:hg, 'ssh://robin@localhost/home/robin/hg')
      assert_url_error(:hg, 'ssh://localhost/home/robin/hg')
    end

    it 'wont have errors for valid urls' do
      assert_url_valid(:hg, 'http://www.selenic.com/repo/hello')
      assert_url_valid(:hg, 'http://www.selenic.com:80/repo/hello')
      assert_url_valid(:hg, 'https://www.selenic.com/repo/hello')
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
ohloh_scm-4.0.5 spec/ohloh_scm/hg/validation_spec.rb
ohloh_scm-4.0.4 spec/ohloh_scm/hg/validation_spec.rb
ohloh_scm-4.0.3 spec/ohloh_scm/hg/validation_spec.rb
ohloh_scm-4.0.2 spec/ohloh_scm/hg/validation_spec.rb
ohloh_scm-4.0.1 spec/ohloh_scm/hg/validation_spec.rb
ohloh_scm-3.0.21 spec/ohloh_scm/hg/validation_spec.rb
ohloh_scm-3.0.19 spec/ohloh_scm/hg/validation_spec.rb
ohloh_scm-3.0.17 spec/ohloh_scm/hg/validation_spec.rb
ohloh_scm-3.0.16 spec/ohloh_scm/hg/validation_spec.rb
ohloh_scm-3.0.15 spec/ohloh_scm/hg/validation_spec.rb
ohloh_scm-3.0.14 spec/ohloh_scm/hg/validation_spec.rb
ohloh_scm-3.0.13 spec/ohloh_scm/hg/validation_spec.rb
ohloh_scm-3.0.12 spec/ohloh_scm/hg/validation_spec.rb
ohloh_scm-3.0.11 spec/ohloh_scm/hg/validation_spec.rb
ohloh_scm-3.0.10 spec/ohloh_scm/hg/validation_spec.rb
ohloh_scm-3.0.9 spec/ohloh_scm/hg/validation_spec.rb
ohloh_scm-3.0.8 spec/ohloh_scm/hg/validation_spec.rb
ohloh_scm-3.0.7 spec/ohloh_scm/hg/validation_spec.rb
ohloh_scm-3.0.6 spec/ohloh_scm/hg/validation_spec.rb
ohloh_scm-3.0.5 spec/ohloh_scm/hg/validation_spec.rb