From e03a018d28488260eb6c69741680691426f823a6 Mon Sep 17 00:00:00 2001
From: Sato Hiroyuki <sathiroyuki@gmail.com>
Date: Thu, 7 Mar 2013 15:42:30 +0900
Subject: [PATCH] Refactor: rename module and class names.

* Module: Graph -> Network
* Class: JsonBuilder -> Graph
---
 app/controllers/graph_controller.rb                    |  2 +-
 app/models/{graph => network}/commit.rb                |  2 +-
 app/models/{graph/json_builder.rb => network/graph.rb} | 10 +++++-----
 features/steps/project/project_network_graph.rb        |  8 ++++----
 features/steps/shared/paths.rb                         |  4 ++--
 5 files changed, 13 insertions(+), 13 deletions(-)
 rename app/models/{graph => network}/commit.rb (98%)
 rename app/models/{graph/json_builder.rb => network/graph.rb} (97%)

diff --git a/app/controllers/graph_controller.rb b/app/controllers/graph_controller.rb
index d27fd03947..b4bf956511 100644
--- a/app/controllers/graph_controller.rb
+++ b/app/controllers/graph_controller.rb
@@ -22,7 +22,7 @@ class GraphController < ProjectResourceController
       format.html
 
       format.json do
-        @graph = Graph::JsonBuilder.new(project, @ref, @commit)
+        @graph = Network::Graph.new(project, @ref, @commit)
       end
     end
   end
diff --git a/app/models/graph/commit.rb b/app/models/network/commit.rb
similarity index 98%
rename from app/models/graph/commit.rb
rename to app/models/network/commit.rb
index e47a543daa..9c0a99ccd4 100644
--- a/app/models/graph/commit.rb
+++ b/app/models/network/commit.rb
@@ -1,6 +1,6 @@
 require "grit"
 
-module Graph
+module Network
   class Commit
     include ActionView::Helpers::TagHelper
 
diff --git a/app/models/graph/json_builder.rb b/app/models/network/graph.rb
similarity index 97%
rename from app/models/graph/json_builder.rb
rename to app/models/network/graph.rb
index 2e0edb8a9c..c9ecbc910e 100644
--- a/app/models/graph/json_builder.rb
+++ b/app/models/network/graph.rb
@@ -1,7 +1,7 @@
 require "grit"
 
-module Graph
-  class JsonBuilder
+module Network
+  class Graph
     attr_accessor :days, :commits, :ref_cache, :repo
 
     def self.max_count
@@ -19,7 +19,7 @@ module Graph
       @days = index_commits
     end
 
-  protected
+    protected
 
     # Get commits from repository
     #
@@ -30,8 +30,8 @@ module Graph
       # Decorate with app/models/commit.rb
       @commits.map! { |commit| Commit.new(commit) }
 
-      # Decorate with lib/gitlab/graph/commit.rb
-      @commits.map! { |commit| Graph::Commit.new(commit) }
+      # Decorate with app/model/network/commit.rb
+      @commits.map! { |commit| Network::Commit.new(commit) }
 
       # add refs to each commit
       @commits.each { |commit| commit.add_refs(ref_cache, repo) }
diff --git a/features/steps/project/project_network_graph.rb b/features/steps/project/project_network_graph.rb
index 7e9a7c295d..cf5fa751cc 100644
--- a/features/steps/project/project_network_graph.rb
+++ b/features/steps/project/project_network_graph.rb
@@ -8,8 +8,8 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
   end
 
   When 'I visit project "Shop" network page' do
-    # Stub Graph::JsonBuilder max_size to speed up test (10 commits vs. 650)
-    Graph::JsonBuilder.stub(max_count: 10)
+    # Stub Graph max_size to speed up test (10 commits vs. 650)
+    Network::Graph.stub(max_count: 10)
 
     project = Project.find_by_name("Shop")
     visit project_graph_path(project, "master")
@@ -25,7 +25,7 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
     end
   end
 
-  And 'I switch ref to "stable"' do
+  When 'I switch ref to "stable"' do
     page.select 'stable', :from => 'ref'
     sleep 2
   end
@@ -40,7 +40,7 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
     end
   end
 
-  And 'I looking for a commit by SHA of "v2.1.0"' do
+  When 'I looking for a commit by SHA of "v2.1.0"' do
     within ".content .search" do
       fill_in 'q', :with => '98d6492'
       find('button').click
diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb
index 431d5299d8..54cdbd4ba2 100644
--- a/features/steps/shared/paths.rb
+++ b/features/steps/shared/paths.rb
@@ -142,8 +142,8 @@ module SharedPaths
   end
 
   Given "I visit my project's network page" do
-    # Stub Graph::JsonBuilder max_size to speed up test (10 commits vs. 650)
-    Graph::JsonBuilder.stub(max_count: 10)
+    # Stub Graph max_size to speed up test (10 commits vs. 650)
+    Network::Graph.stub(max_count: 10)
 
     visit project_graph_path(@project, root_ref)
   end
-- 
2.30.9