2016-06-29 06:24:58 -04:00
|
|
|
require "spec_helper"
|
|
|
|
|
|
|
|
describe "Compare", js: true do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
project.team << [user, :master]
|
|
|
|
login_as user
|
|
|
|
visit namespace_project_compare_index_path(project.namespace, project, from: "master", to: "master")
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "branches" do
|
2016-07-25 14:16:19 -04:00
|
|
|
it "pre-populates fields" do
|
2016-09-27 13:29:12 -04:00
|
|
|
expect(find(".js-compare-from-dropdown .dropdown-toggle-text")).to have_content("master")
|
|
|
|
expect(find(".js-compare-to-dropdown .dropdown-toggle-text")).to have_content("master")
|
2016-06-29 06:24:58 -04:00
|
|
|
end
|
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it "compares branches" do
|
2016-09-27 13:29:12 -04:00
|
|
|
select_using_dropdown "from", "feature"
|
|
|
|
expect(find(".js-compare-from-dropdown .dropdown-toggle-text")).to have_content("feature")
|
2016-06-29 06:24:58 -04:00
|
|
|
|
2016-09-27 13:29:12 -04:00
|
|
|
select_using_dropdown "to", "binary-encoding"
|
|
|
|
expect(find(".js-compare-to-dropdown .dropdown-toggle-text")).to have_content("binary-encoding")
|
2016-06-29 06:24:58 -04:00
|
|
|
|
|
|
|
click_button "Compare"
|
|
|
|
expect(page).to have_content "Commits"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "tags" do
|
2016-07-25 14:16:19 -04:00
|
|
|
it "compares tags" do
|
2016-09-27 13:29:12 -04:00
|
|
|
select_using_dropdown "from", "v1.0.0"
|
|
|
|
expect(find(".js-compare-from-dropdown .dropdown-toggle-text")).to have_content("v1.0.0")
|
2016-06-29 06:24:58 -04:00
|
|
|
|
2016-09-27 13:29:12 -04:00
|
|
|
select_using_dropdown "to", "v1.1.0"
|
|
|
|
expect(find(".js-compare-to-dropdown .dropdown-toggle-text")).to have_content("v1.1.0")
|
2016-06-29 06:24:58 -04:00
|
|
|
|
|
|
|
click_button "Compare"
|
|
|
|
expect(page).to have_content "Commits"
|
|
|
|
end
|
|
|
|
end
|
2016-09-27 13:29:12 -04:00
|
|
|
|
|
|
|
def select_using_dropdown(dropdown_type, selection)
|
|
|
|
dropdown = find(".js-compare-#{dropdown_type}-dropdown")
|
|
|
|
dropdown.find(".compare-dropdown-toggle").click
|
2016-10-17 00:09:38 -04:00
|
|
|
dropdown.fill_in("Filter by Git revision", with: selection)
|
2016-10-14 19:47:55 -04:00
|
|
|
find_link(selection, visible: true).click
|
2016-09-27 13:29:12 -04:00
|
|
|
end
|
2016-06-29 06:24:58 -04:00
|
|
|
end
|