require 'spec_helper' describe 'Project Graph', :js do let(:user) { create :user } let(:project) { create(:project, :repository, namespace: user.namespace) } let(:branch_name) { 'master' } before do project.add_master(user) sign_in(user) end shared_examples 'page should have commits graphs' do it 'renders commits' do expect(page).to have_content("Commit statistics for #{branch_name}") expect(page).to have_content('Commits per day of month') end end shared_examples 'page should have languages graphs' do it 'renders languages' do expect(page).to have_content(/Ruby 66.* %/) expect(page).to have_content(/JavaScript 22.* %/) end end it 'renders graphs' do visit project_graph_path(project, 'master') expect(page).to have_selector('.stat-graph', visible: false) end context 'commits graph' do before do visit commits_project_graph_path(project, 'master') end it_behaves_like 'page should have commits graphs' it_behaves_like 'page should have languages graphs' end context 'languages graph' do before do visit languages_project_graph_path(project, 'master') end it_behaves_like 'page should have commits graphs' it_behaves_like 'page should have languages graphs' end context 'charts graph' do before do visit charts_project_graph_path(project, 'master') end it_behaves_like 'page should have commits graphs' it_behaves_like 'page should have languages graphs' end context 'chart graph with HTML escaped branch name' do let(:branch_name) { '