summaryrefslogtreecommitdiff
path: root/spec/requests/projects_tree_perfomance_spec.rb
blob: 93876354416da3d1df43e28e891d132acff6b786 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require 'spec_helper'
require 'benchmark'

describe "Projects" do
  before { login_as :user }

  describe "GET /projects/tree" do
    describe "head" do
      before do
        @project = Factory :project
        @project.add_access(@user, :read)
      end

      it "should be fast" do
        time = Benchmark.realtime do
          visit tree_project_ref_path(@project, @project.root_ref)
        end
        (time < 1.0).should be_true
      end
    end

    describe ValidCommit::ID do
      before do
        @project = Factory :project
        @project.add_access(@user, :read)
      end

      it "should be fast" do
        time = Benchmark.realtime do
          visit tree_project_ref_path(@project, ValidCommit::ID)
        end
        (time < 1.0).should be_true
      end
    end
  end
end