debian-mirror-gitlab/spec/helpers/tree_helper_spec.rb

29 lines
737 B
Ruby
Raw Normal View History

2015-04-26 12:48:37 +05:30
require 'spec_helper'
describe TreeHelper do
describe 'flatten_tree' do
let(:project) { create(:project) }
2015-09-11 14:41:01 +05:30
before do
2015-04-26 12:48:37 +05:30
@repository = project.repository
2015-09-11 14:41:01 +05:30
@commit = project.commit("e56497bb")
end
2015-04-26 12:48:37 +05:30
context "on a directory containing more than one file/directory" do
let(:tree_item) { double(name: "files", path: "files") }
it "should return the directory name" do
expect(flatten_tree(tree_item)).to match('files')
end
end
context "on a directory containing only one directory" do
let(:tree_item) { double(name: "foo", path: "foo") }
it "should return the flattened path" do
expect(flatten_tree(tree_item)).to match('foo/bar')
end
end
end
end