diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-10-20 17:14:31 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-10-20 17:14:31 +0800 |
commit | e5de4c77acbc128d1e8b8a0c3e469542ead8202f (patch) | |
tree | b78b8a994814f5edb82011ab6641837b6d516eb8 /spec/support | |
parent | cefc7eb15bd7526a7c40fc0a1ca3534c2a12a0ef (diff) | |
parent | b5cee66612fca4f1fb9791f1c8615039d1703df3 (diff) | |
download | gitlab-ce-e5de4c77acbc128d1e8b8a0c3e469542ead8202f.tar.gz |
Merge remote-tracking branch 'upstream/master' into pipeline-notifications
* upstream/master: (221 commits)
Differentiate the expire from leave event
Use LabelsFinder on Fogbuz importer
Use LabelsFinder on Google Code importer
Change the order of tested methods in project_members_controller_spec
Remove show_menu_above attribute from issuable dropdowns.
Spaces before `}`!
Avoid touch label links that does not belongs to project when moving it
Remove order by label type on LabelsFinder
Rename Labels::CreateService to Labels::FindOrCreateService
Add self.project_foreign_key on both Issue and MergeRequest
Only show label type for projects that belong to a group
Disable subscribing to group-level labels
Remove unused method Project#all_labels
Update specs to cope with new label types and priorities
Fix max number of permitted priorities per project label
Fix GitHub importer spec
Update CHANGELOG
Add support to group labels to SlashCommands::InterpretService
Use join instead of subquery on Label.unprioritized scope
Warn user deleting a group label affect all projects within the group
...
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/issue_tracker_service_shared_example.rb | 15 | ||||
-rw-r--r-- | spec/support/matchers/be_like_time.rb | 13 | ||||
-rw-r--r-- | spec/support/wait_for_ajax.rb | 4 |
3 files changed, 32 insertions, 0 deletions
diff --git a/spec/support/issue_tracker_service_shared_example.rb b/spec/support/issue_tracker_service_shared_example.rb index b6d7436c360..e70b3963d9d 100644 --- a/spec/support/issue_tracker_service_shared_example.rb +++ b/spec/support/issue_tracker_service_shared_example.rb @@ -5,3 +5,18 @@ RSpec.shared_examples 'issue tracker service URL attribute' do |url_attr| it { is_expected.not_to allow_value('ftp://example.com').for(url_attr) } it { is_expected.not_to allow_value('herp-and-derp').for(url_attr) } end + +RSpec.shared_examples 'allows project key on reference pattern' do |url_attr| + it 'allows underscores in the project name' do + expect(subject.reference_pattern.match('EXT_EXT-1234')[0]).to eq 'EXT_EXT-1234' + end + + it 'allows numbers in the project name' do + expect(subject.reference_pattern.match('EXT3_EXT-1234')[0]).to eq 'EXT3_EXT-1234' + end + + it 'requires the project name to begin with A-Z' do + expect(subject.reference_pattern.match('3EXT_EXT-1234')).to eq nil + expect(subject.reference_pattern.match('EXT_EXT-1234')[0]).to eq 'EXT_EXT-1234' + end +end diff --git a/spec/support/matchers/be_like_time.rb b/spec/support/matchers/be_like_time.rb new file mode 100644 index 00000000000..1f27390eab7 --- /dev/null +++ b/spec/support/matchers/be_like_time.rb @@ -0,0 +1,13 @@ +RSpec::Matchers.define :be_like_time do |expected| + match do |actual| + expect(actual).to be_within(1.second).of(expected) + end + + description do + "within one second of #{expected}" + end + + failure_message do |actual| + "expected #{actual} to be within one second of #{expected}" + end +end diff --git a/spec/support/wait_for_ajax.rb b/spec/support/wait_for_ajax.rb index b90fc112671..0f9dc2dee75 100644 --- a/spec/support/wait_for_ajax.rb +++ b/spec/support/wait_for_ajax.rb @@ -8,4 +8,8 @@ module WaitForAjax def finished_all_ajax_requests? page.evaluate_script('jQuery.active').zero? end + + def javascript_test? + [:selenium, :webkit, :chrome, :poltergeist].include?(Capybara.current_driver) + end end |