Sha256: 85f30cd76c52e1350b660681053d5cc4a38865d6c21626717f49490043e4e787

Contents?: true

Size: 1.11 KB

Versions: 7

Compression:

Stored size: 1.11 KB

Contents

require File.dirname(__FILE__) + '/helper'

describe Mercurial::Node do
  
  before do
    @repository = Mercurial::Repository.open(Fixtures.test_repo)
  end
  
  it "should be considered directory when ends with a slash" do
    node = @repository.nodes.find('new-directory/subdirectory/', 'a8b39838302f')
    node.file?.must_equal false
    node.directory?.must_equal true
  end
  
  it "should be considered file when doesn't end with a slash" do
    node = @repository.nodes.find('new-directory/something.csv', 'a8b39838302f')
    node.file?.must_equal true
    node.directory?.must_equal false
  end
  
  it "should show node contents" do
    node = @repository.nodes.find('new-directory/something.csv', 'a8b39838302f')
    node.contents.strip.must_equal 'Here will be CSV.'
    
    node = @repository.nodes.find('new-directory/something.csv', '291a498f04e9')
    node.contents.strip.must_equal 'Here will be some new kind of CSV.'
  end
  
  it "should fetch contents of a node with whitespace in it's name" do
    node = @repository.nodes.find('File With Whitespace.pdf', '8ddac5f6380e')
    node.contents.must_equal ''
  end
  
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mercurial-ruby-0.7.8 test/test_node.rb
mercurial-ruby-0.7.7 test/test_node.rb
mercurial-ruby-0.7.6 test/test_node.rb
mercurial-ruby-0.7.5 test/test_node.rb
mercurial-ruby-0.7.4 test/test_node.rb
mercurial-ruby-0.7.3 test/test_node.rb
mercurial-ruby-0.7.2 test/test_node.rb