From 1738055dabb902b45d07839bec053bfc59fd05ee Mon Sep 17 00:00:00 2001
From: Sato Hiroyuki <sathiroyuki@gmail.com>
Date: Sun, 14 Apr 2013 09:15:35 +0000
Subject: [PATCH] Add test for "Show only selected tag"

---
 features/project/network.feature              |  9 +++++++
 .../steps/project/project_network_graph.rb    | 26 +++++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/features/project/network.feature b/features/project/network.feature
index 538124a4c5..f98e19b60d 100644
--- a/features/project/network.feature
+++ b/features/project/network.feature
@@ -25,3 +25,12 @@ Feature: Project Network Graph
     Then page should have network graph
     And page should select "master" in select box
     And page should have "v2.1.0" on graph
+
+  @javascript
+  Scenario: I should filter selected tag
+    When I switch ref to "v2.1.0"
+    Then page should have content not cotaining "v2.1.0"
+    When click "Show only selected branch" checkbox
+    Then page should not have content not cotaining "v2.1.0"
+    When click "Show only selected branch" checkbox
+    Then page should have content not cotaining "v2.1.0"
diff --git a/features/steps/project/project_network_graph.rb b/features/steps/project/project_network_graph.rb
index 8db6a39e99..48a73f09fa 100644
--- a/features/steps/project/project_network_graph.rb
+++ b/features/steps/project/project_network_graph.rb
@@ -19,6 +19,10 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
     page.should have_selector '#ref_chzn span', text: "master"
   end
 
+  And 'page should select "v2.1.0" in select box' do
+    page.should have_selector '#ref_chzn span', text: "v2.1.0"
+  end
+
   And 'page should have "master" on graph' do
     within '.graph' do
       page.should have_content 'master'
@@ -35,6 +39,28 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
     sleep 2
   end
 
+  When 'I switch ref to "v2.1.0"' do
+    page.select 'v2.1.0', from: 'ref'
+    sleep 2
+  end
+
+  When 'click "Show only selected branch" checkbox' do
+    find('#filter_ref').click
+    sleep 2
+  end
+
+  Then 'page should have content not cotaining "v2.1.0"' do
+    within '.graph' do
+      page.should have_content 'cleaning'
+    end
+  end
+
+  Then 'page should not have content not cotaining "v2.1.0"' do
+    within '.graph' do
+      page.should_not have_content 'cleaning'
+    end
+  end
+
   And 'page should select "stable" in select box' do
     page.should have_selector '#ref_chzn span', text: "stable"
   end
-- 
2.30.9