gitlab-org--gitlab-foss/spec/helpers/tree_helper_spec.rb

29 lines
725 B
Ruby
Raw Normal View History

2015-01-10 15:37:48 -05:00
require 'spec_helper'
describe TreeHelper do
describe 'flatten_tree' do
let(:project) { create(:project) }
2015-06-22 16:00:54 -04:00
before do
@repository = project.repository
@commit = project.commit("e56497bb")
2015-06-22 16:00:54 -04:00
end
2015-01-10 15:37:48 -05:00
context "on a directory containing more than one file/directory" do
let(:tree_item) { double(name: "files", path: "files") }
it "returns the directory name" do
expect(flatten_tree(tree_item)).to match('files')
2015-01-10 15:37:48 -05:00
end
end
context "on a directory containing only one directory" do
let(:tree_item) { double(name: "foo", path: "foo") }
it "returns the flattened path" do
expect(flatten_tree(tree_item)).to match('foo/bar')
2015-01-10 15:37:48 -05:00
end
end
end
end