top_panel_spec.rb 837 Bytes
Newer Older
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
1
__END__
gitlabhq's avatar
gitlabhq committed
2 3 4 5 6 7
require 'spec_helper'

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

  describe "Search autocomplete" do
Nihad Abbasov's avatar
Nihad Abbasov committed
8
    before do
gitlabhq's avatar
gitlabhq committed
9 10
      visit projects_path
      fill_in "search", :with => "Ke"
11
      within ".ui-autocomplete" do
12 13
        find(:xpath, "//a[.=\"Keys\"]").click
      end
gitlabhq's avatar
gitlabhq committed
14 15 16
    end

    it "should be on projects page" do
Nihad Abbasov's avatar
Nihad Abbasov committed
17
      current_path.should == keys_path
gitlabhq's avatar
gitlabhq committed
18 19 20 21
    end
  end

  describe "with project" do
Nihad Abbasov's avatar
Nihad Abbasov committed
22
    before do
gitlabhq's avatar
gitlabhq committed
23 24 25 26 27
      @project = Factory :project
      @project.add_access(@user, :read)
      visit project_path(@project)

      fill_in "search", :with => "Commi"
28
      within ".ui-autocomplete" do
29 30
        find(:xpath, "//a[.=\"#{@project.code} / Commits\"]").click
      end
gitlabhq's avatar
gitlabhq committed
31 32 33
    end

    it "should be on projects page" do
Nihad Abbasov's avatar
Nihad Abbasov committed
34
      current_path.should == project_commits_path(@project)
gitlabhq's avatar
gitlabhq committed
35 36 37
    end
  end
end