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 4 Background:
5 5 Given I signin as a user
6 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 9 Scenario: I should see project network
10 10 Then page should have network graph
11   -
12   -
... ...
features/step_definitions/project/projects_steps.rb
... ... @@ -57,6 +57,11 @@ end
57 57  
58 58 Given /^I visit project "(.*?)" network page$/ do |arg1|
59 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 65 visit graph_project_path(project)
61 66 end
62 67  
... ... @@ -67,8 +72,8 @@ end
67 72 Given /^page should have network graph$/ do
68 73 page.should have_content "Project Network Graph"
69 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 77 end
73 78 end
74 79  
... ...
features/support/env.rb
... ... @@ -44,3 +44,5 @@ require 'headless'
44 44  
45 45 headless = Headless.new
46 46 headless.start
  47 +
  48 +require 'cucumber/rspec/doubles'
... ...