diff options
author | marmis85 <marmis85@gmail.com> | 2015-01-10 23:37:48 +0300 |
---|---|---|
committer | marmis85 <marmis85@gmail.com> | 2015-01-10 23:37:48 +0300 |
commit | 3efb06a22bb970c0e6db0bbd1fc9f8c4caba44ba (patch) | |
tree | 71c3258814ed0fecdf39c7ee5259f98853ea918c /spec | |
parent | 021cff67f3514b4c2cb1f7b859cbfc314afa0a0c (diff) |
Add test spec for TreeHelper module
Diffstat (limited to 'spec')
-rw-r--r-- | spec/helpers/tree_helper_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/helpers/tree_helper_spec.rb b/spec/helpers/tree_helper_spec.rb new file mode 100644 index 00000000000..ad3535a15e6 --- /dev/null +++ b/spec/helpers/tree_helper_spec.rb @@ -0,0 +1,28 @@ +require 'spec_helper' + +describe TreeHelper do + describe 'flatten_tree' do + let(:project) { create(:project) } + + before { + @repository = project.repository + @commit = project.repository.commit + } + + 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 + flatten_tree(tree_item).should 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 + flatten_tree(tree_item).should match('foo/bar') + end + end + end +end |