Skip to content

Commit

Permalink
Merge pull request #3076 from bgeuken/request_list
Browse files Browse the repository at this point in the history
[ci] Add rspec tests for going through a list of requests
  • Loading branch information
ChrisBr committed May 5, 2017
2 parents 4ffb4de + e1b9196 commit 53148f5
Show file tree
Hide file tree
Showing 2 changed files with 275 additions and 0 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions src/api/spec/features/webui/requests_spec.rb
Expand Up @@ -293,4 +293,39 @@ def branch_and_change_sources
end
end
end

describe 'project with list of requests' do
let(:project) { create(:project, name: 'my_project') }
let!(:request_1) { create(:bs_request, source_project: project, type: 'submit', created_at: Time.now + 1) }
let!(:request_2) { create(:bs_request, source_project: project, type: 'submit', created_at: Time.now + 2) }
let!(:request_3) { create(:bs_request, source_project: project, type: 'submit', created_at: Time.now + 3) }

before do
project.relationships.create(user: submitter, role: Role.where(title: 'maintainer').first)
end

scenario 'going through a request list' do
login(submitter)
visit project_requests_path(project: project)

expect(page).to have_text("Requests for #{project}")
expect(page).to have_link("Show request ##{request_1.id}")
expect(page).to have_link("Show request ##{request_2.id}")
expect(page).to have_link("Show request ##{request_3.id}")

click_link("Show request ##{request_1.id}")
expect(page).to have_text("Request #{request_1.id} (new)")
expect(page).not_to have_link('>>')

click_link('<<')
expect(page).to have_text("Request #{request_2.id} (new)")

click_link('<<')
expect(page).to have_text("Request #{request_3.id} (new)")
expect(page).not_to have_link('<<')

click_link('>>')
expect(page).to have_text("Request #{request_2.id} (new)")
end
end
end

0 comments on commit 53148f5

Please sign in to comment.