<commit_before>require 'spec_helper'

describe 'dashboard' do

	context 'with only one page of companies' do
		it 'No Prev or Next' do
			stub_one_company_page

			stub_one_company

			visit '/dashboard'

			expect(page).to have_content("Keen IO")
			expect(page).to have_content("Keen IO is a custom analytics back-end for modern developers.")
			expect(page).not_to have_content("Prev")
			expect(page).not_to have_content("Next")
		end
	end

	context 'with three pages of companies' do

		before(:each) do
			stub_three_company_pages

			stub_each_company_for_the_first_page
		end

		it 'first page only sees Next' do
			visit '/dashboard'

			expect(page).not_to have_content('Prev')
			expect(page).to have_content('Next')
		end

		it 'second page sees Prev and Next' do
			visit '/dashboard?page_companies=2'

			expect(page).to have_content('Prev')
			expect(page).to have_content('Next')
		end

		it 'thirsd page sees only Prev' do
			visit '/dashboard?page_companies=3'

			expect(page).to have_content('Prev')
			expect(page).not_to have_content('Next')
		end
	end
end<commit_msg>We need to add the stubs for the product accesses and also we add a test for the product list<commit_after>require 'spec_helper'

describe 'dashboard' do

	context 'with only one page of companies and products' do
		it 'No Prev or Next' do
			stub_one_company_page

			stub_one_company

			stub_one_product_page

			stub_one_product

			visit '/dashboard'

			expect(page).to have_content("Keen IO")
			expect(page).to have_content("Keen IO is a custom analytics back-end for modern developers.")
			expect(page).to have_content("Basecamp")
			expect(page).to have_content("Basecamp is a project management ")
			expect(page).not_to have_content("Prev")
			expect(page).not_to have_content("Next")
		end
	end

	context 'with three pages of companies' do

		before(:each) do
			stub_three_company_pages

			stub_each_company_for_the_first_page

			stub_one_product_page

			stub_one_product
		end

		it 'first page only sees Next' do
			visit '/dashboard'

			expect(page).not_to have_content('Prev')
			expect(page).to have_content('Next')
		end

		it 'second page sees Prev and Next' do
			visit '/dashboard?page_companies=2&page_products=1'

			expect(page).to have_content('Prev')
			expect(page).to have_content('Next')
		end

		it 'thirsd page sees only Prev' do
			visit '/dashboard?page_companies=3&page_products=1'

			expect(page).to have_content('Prev')
			expect(page).not_to have_content('Next')
		end
	end

	context 'with three pages of products' do

		before(:each) do
			stub_one_company_page

			stub_one_company

			stub_three_product_pages

			stub_each_product_for_the_first_page
		end

		it 'first page only sees Next' do
			visit '/dashboard'

			expect(page).not_to have_content('Prev')
			expect(page).to have_content('Next')
		end

		it 'second page sees Prev and Next' do
			visit '/dashboard?page_companies=1&page_products=2'

			expect(page).to have_content('Prev')
			expect(page).to have_content('Next')
		end

		it 'thirsd page sees only Prev' do
			visit '/dashboard?page_companies=1&page_products=3'

			expect(page).to have_content('Prev')
			expect(page).not_to have_content('Next')
		end
	end
end
{'fraction_non_alphanumeric': 0.09562247749146228, 'fraction_numerical': 0.003104625892579944, 'mean_word_length': 4.2993421052631575, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6321623', 'n_tokens_mistral': 1230, 'n_tokens_neox': 1071, 'n_words': 290}