Commit d862ebd3b340d46937e0bf37c382fd93056b238e

Authored by Dmitriy Zaporozhets
2 parents 3784f134 6baf9c44

Merge pull request #1266 from tsigo/cucumber_speedup

Speed up the "Project Network Graph" cucumber feature
features/projects/network.feature
@@ -4,9 +4,7 @@ Feature: Project Network Graph @@ -4,9 +4,7 @@ Feature: Project Network Graph
4 Background: 4 Background:
5 Given I signin as a user 5 Given I signin as a user
6 And I own project "Shop" 6 And I own project "Shop"
7 - And I visit project "Shop" network page 7 + And I visit project "Shop" network page
8 8
9 Scenario: I should see project network 9 Scenario: I should see project network
10 Then page should have network graph 10 Then page should have network graph
11 -  
12 -  
features/step_definitions/project/projects_steps.rb
@@ -57,6 +57,11 @@ end @@ -57,6 +57,11 @@ end
57 57
58 Given /^I visit project "(.*?)" network page$/ do |arg1| 58 Given /^I visit project "(.*?)" network page$/ do |arg1|
59 project = Project.find_by_name(arg1) 59 project = Project.find_by_name(arg1)
  60 +
  61 + # Stub out find_all to speed this up (10 commits vs. 650)
  62 + commits = Grit::Commit.find_all(project.repo, nil, {max_count: 10})
  63 + Grit::Commit.stub(:find_all).and_return(commits)
  64 +
60 visit graph_project_path(project) 65 visit graph_project_path(project)
61 end 66 end
62 67
@@ -67,8 +72,8 @@ end @@ -67,8 +72,8 @@ end
67 Given /^page should have network graph$/ do 72 Given /^page should have network graph$/ do
68 page.should have_content "Project Network Graph" 73 page.should have_content "Project Network Graph"
69 within ".graph" do 74 within ".graph" do
70 - page.should have_content "stable"  
71 - page.should have_content "notes_refacto..." 75 + page.should have_content "master"
  76 + page.should have_content "scss_refactor..."
72 end 77 end
73 end 78 end
74 79
features/support/env.rb
@@ -44,3 +44,5 @@ require 'headless' @@ -44,3 +44,5 @@ require 'headless'
44 44
45 headless = Headless.new 45 headless = Headless.new
46 headless.start 46 headless.start
  47 +
  48 +require 'cucumber/rspec/doubles'