Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8304 from h-kataria/catalogs_tree_fix
Do not show items not marked to be displayed in Catalog in tree
- Loading branch information
Showing
2 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
describe TreeBuilderServiceCatalog do | ||
include CompressedIds | ||
before do | ||
Tenant.seed | ||
@catalog = FactoryGirl.create(:service_template_catalog, :name => "My Catalog") | ||
FactoryGirl.create(:service_template, | ||
:name => "Display in Catalog", | ||
:service_template_catalog => @catalog, | ||
:display => true) | ||
FactoryGirl.create(:service_template, | ||
:name => "Do not Display in Catalog", | ||
:service_template_catalog => @catalog, | ||
:display => false) | ||
@tree = TreeBuilderServiceCatalog.new(:svccat_tree, "svccat", {}) | ||
end | ||
|
||
it "#x_get_tree_roots" do | ||
roots = @tree.send(:x_get_tree_roots, false, {}) | ||
expect(roots.first.name).to eq(@catalog.name) | ||
end | ||
|
||
it "#x_get_tree_stc_kids returns items that are set to be displayed in catalog" do | ||
items = @tree.send(:x_get_tree_stc_kids, @catalog, false) | ||
expect(items.size).to eq(1) | ||
expect(items.first.name).to eq("Display in Catalog") | ||
end | ||
end |