list_spec.rb 948 Bytes
Newer Older
1 2 3 4 5 6 7 8
require 'spec_helper'

feature 'list of badges' do
  background do
    user = create(:user)
    project = create(:project)
    project.team << [user, :master]
    login_as(user)
9
    visit namespace_project_badges_path(project.namespace, project)
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
  end

  scenario 'user displays list of badges' do
    expect(page).to have_content 'build status'
    expect(page).to have_content 'Markdown'
    expect(page).to have_content 'HTML'
    expect(page).to have_css('.highlight', count: 2)
    expect(page).to have_xpath("//img[@alt='build status']")

    page.within('.highlight', match: :first) do
      expect(page).to have_content 'badges/master/build.svg'
    end
  end

  scenario 'user changes current ref on badges list page', js: true do
Phil Hughes's avatar
Phil Hughes committed
25 26 27 28 29
    first('.js-project-refs-dropdown').click

    page.within '.project-refs-form' do
      click_link 'improve/awesome'
    end
30 31 32 33

    expect(page).to have_content 'badges/improve/awesome/build.svg'
  end
end