summaryrefslogtreecommitdiff
path: root/spec/requests/top_panel_spec.rb
blob: bd4d204779646f0610415f5d3c73cb811e66a9f9 (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
require 'spec_helper'

describe "Top Panel", :js => true do
  before { login_as :user }

  describe "Search autocomplete" do
    before do 
      visit projects_path
      fill_in "search", :with => "Ke"
      sleep(2)
      find(:xpath, "//ul[contains(@class,'ui-autocomplete')]/li/a[.=\"Keys\"]").click
    end

    it "should be on projects page" do
      current_path.should == keys_path 
    end
  end

  describe "with project" do
    before do 
      @project = Factory :project
      @project.add_access(@user, :read)
      visit project_path(@project)

      fill_in "search", :with => "Commi"
      sleep(2)
      find(:xpath, "//ul[contains(@class,'ui-autocomplete')]/li/a[.=\"#{@project.code} / Commits\"]").click
    end

    it "should be on projects page" do
      current_path.should == project_commits_path(@project) 
    end
  end
end