summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClement Ho <ClemMakesApps@gmail.com>2017-02-24 10:09:53 -0600
committerClement Ho <ClemMakesApps@gmail.com>2017-02-24 11:40:17 -0600
commit2da9541bf9acd3c32f541914710aa34a9d4787bf (patch)
tree376e5dc811bebccbd0534f3ac8f3fb05985da598
parent80d4faaa4b0536633eea86308fec6e50e86c85c4 (diff)
downloadgitlab-ce-filtered-search-improve-ruby.tar.gz
-rw-r--r--spec/features/issues/filtered_search/dropdown_assignee_spec.rb12
-rw-r--r--spec/features/issues/filtered_search/dropdown_author_spec.rb8
-rw-r--r--spec/features/issues/filtered_search/dropdown_hint_spec.rb32
-rw-r--r--spec/features/issues/filtered_search/dropdown_label_spec.rb36
-rw-r--r--spec/features/issues/filtered_search/dropdown_milestone_spec.rb36
-rw-r--r--spec/features/issues/filtered_search/filter_issues_spec.rb204
-rw-r--r--spec/features/issues/filtered_search/search_bar_spec.rb4
-rw-r--r--spec/features/merge_requests/filter_by_milestone_spec.rb4
-rw-r--r--spec/features/merge_requests/filter_merge_requests_spec.rb66
-rw-r--r--spec/features/search_spec.rb16
-rw-r--r--spec/support/filtered_search_helpers.rb10
11 files changed, 217 insertions, 211 deletions
diff --git a/spec/features/issues/filtered_search/dropdown_assignee_spec.rb b/spec/features/issues/filtered_search/dropdown_assignee_spec.rb
index 27808477fed..a74a442d561 100644
--- a/spec/features/issues/filtered_search/dropdown_assignee_spec.rb
+++ b/spec/features/issues/filtered_search/dropdown_assignee_spec.rb
@@ -126,8 +126,8 @@ describe 'Dropdown assignee', js: true, feature: true do
click_assignee(user_jacob.name)
expect(page).to have_css(js_dropdown_assignee, visible: false)
- expect_tokens([{ 'Name' => 'assignee', 'Value' => "@#{user_jacob.username}" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'assignee', value: "@#{user_jacob.username}" }])
+ expect_filtered_search_input_empty
end
it 'fills in the assignee username when the assignee has been filtered' do
@@ -135,16 +135,16 @@ describe 'Dropdown assignee', js: true, feature: true do
click_assignee(user.name)
expect(page).to have_css(js_dropdown_assignee, visible: false)
- expect_tokens([{ 'Name' => 'assignee', 'Value' => "@#{user.username}" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'assignee', value: "@#{user.username}" }])
+ expect_filtered_search_input_empty
end
it 'selects `no assignee`' do
find('#js-dropdown-assignee .filter-dropdown-item', text: 'No Assignee').click
expect(page).to have_css(js_dropdown_assignee, visible: false)
- expect_tokens([{ 'Name' => 'assignee', 'Value' => 'none' }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'assignee', value: 'none' }])
+ expect_filtered_search_input_empty
end
end
diff --git a/spec/features/issues/filtered_search/dropdown_author_spec.rb b/spec/features/issues/filtered_search/dropdown_author_spec.rb
index 13ce97ba2f9..19a00618b12 100644
--- a/spec/features/issues/filtered_search/dropdown_author_spec.rb
+++ b/spec/features/issues/filtered_search/dropdown_author_spec.rb
@@ -122,16 +122,16 @@ describe 'Dropdown author', js: true, feature: true do
click_author(user_jacob.name)
expect(page).to have_css(js_dropdown_author, visible: false)
- expect_tokens([{ 'Name' => 'author', 'Value' => "@#{user_jacob.username}" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'author', value: "@#{user_jacob.username}" }])
+ expect_filtered_search_input_empty
end
it 'fills in the author username when the author has been filtered' do
click_author(user.name)
expect(page).to have_css(js_dropdown_author, visible: false)
- expect_tokens([{ 'Name' => 'author', 'Value' => "@#{user.username}" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'author', value: "@#{user.username}" }])
+ expect_filtered_search_input_empty
end
end
diff --git a/spec/features/issues/filtered_search/dropdown_hint_spec.rb b/spec/features/issues/filtered_search/dropdown_hint_spec.rb
index 4455246f2a2..d823f19bfa8 100644
--- a/spec/features/issues/filtered_search/dropdown_hint_spec.rb
+++ b/spec/features/issues/filtered_search/dropdown_hint_spec.rb
@@ -67,8 +67,8 @@ describe 'Dropdown hint', js: true, feature: true do
expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-author', visible: true)
- expect_tokens([{ 'Name' => 'author' }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'author' }])
+ expect_filtered_search_input_empty
end
it 'opens the assignee dropdown when you click on assignee' do
@@ -76,8 +76,8 @@ describe 'Dropdown hint', js: true, feature: true do
expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-assignee', visible: true)
- expect_tokens([{ 'Name' => 'assignee' }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'assignee' }])
+ expect_filtered_search_input_empty
end
it 'opens the milestone dropdown when you click on milestone' do
@@ -85,8 +85,8 @@ describe 'Dropdown hint', js: true, feature: true do
expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-milestone', visible: true)
- expect_tokens([{ 'Name' => 'milestone' }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'milestone' }])
+ expect_filtered_search_input_empty
end
it 'opens the label dropdown when you click on label' do
@@ -94,8 +94,8 @@ describe 'Dropdown hint', js: true, feature: true do
expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-label', visible: true)
- expect_tokens([{ 'Name' => 'label' }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'label' }])
+ expect_filtered_search_input_empty
end
end
@@ -106,8 +106,8 @@ describe 'Dropdown hint', js: true, feature: true do
expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-author', visible: true)
- expect_tokens([{ 'Name' => 'author' }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'author' }])
+ expect_filtered_search_input_empty
end
it 'opens the assignee dropdown when you click on assignee' do
@@ -116,8 +116,8 @@ describe 'Dropdown hint', js: true, feature: true do
expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-assignee', visible: true)
- expect_tokens([{ 'Name' => 'assignee' }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'assignee' }])
+ expect_filtered_search_input_empty
end
it 'opens the milestone dropdown when you click on milestone' do
@@ -126,8 +126,8 @@ describe 'Dropdown hint', js: true, feature: true do
expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-milestone', visible: true)
- expect_tokens([{ 'Name' => 'milestone' }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'milestone' }])
+ expect_filtered_search_input_empty
end
it 'opens the label dropdown when you click on label' do
@@ -136,8 +136,8 @@ describe 'Dropdown hint', js: true, feature: true do
expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-label', visible: true)
- expect_tokens([{ 'Name' => 'label' }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'label' }])
+ expect_filtered_search_input_empty
end
end
end
diff --git a/spec/features/issues/filtered_search/dropdown_label_spec.rb b/spec/features/issues/filtered_search/dropdown_label_spec.rb
index b531476394e..b192064b693 100644
--- a/spec/features/issues/filtered_search/dropdown_label_spec.rb
+++ b/spec/features/issues/filtered_search/dropdown_label_spec.rb
@@ -51,8 +51,8 @@ describe 'Dropdown label', js: true, feature: true do
filtered_search.native.send_keys(:down, :down, :enter)
- expect_tokens([{ 'Name' => 'label', 'Value' => "~#{bug_label.title}" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'label', value: "~#{bug_label.title}" }])
+ expect_filtered_search_input_empty
end
end
@@ -181,8 +181,8 @@ describe 'Dropdown label', js: true, feature: true do
click_label(bug_label.title)
expect(page).not_to have_css(js_dropdown_label)
- expect_tokens([{ 'Name' => 'label', 'Value' => "~#{bug_label.title}" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'label', value: "~#{bug_label.title}" }])
+ expect_filtered_search_input_empty
end
it 'fills in the label name when the label is partially filled' do
@@ -190,56 +190,56 @@ describe 'Dropdown label', js: true, feature: true do
click_label(bug_label.title)
expect(page).not_to have_css(js_dropdown_label)
- expect_tokens([{ 'Name' => 'label', 'Value' => "~#{bug_label.title}" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'label', value: "~#{bug_label.title}" }])
+ expect_filtered_search_input_empty
end
it 'fills in the label name that contains multiple words' do
click_label(two_words_label.title)
expect(page).not_to have_css(js_dropdown_label)
- expect_tokens([{ 'Name' => 'label', 'Value' => "\"#{two_words_label.title}\"" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'label', value: "\"#{two_words_label.title}\"" }])
+ expect_filtered_search_input_empty
end
it 'fills in the label name that contains multiple words and is very long' do
click_label(long_label.title)
expect(page).not_to have_css(js_dropdown_label)
- expect_tokens([{ 'Name' => 'label', 'Value' => "\"#{long_label.title}\"" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'label', value: "\"#{long_label.title}\"" }])
+ expect_filtered_search_input_empty
end
it 'fills in the label name that contains double quotes' do
click_label(wont_fix_label.title)
expect(page).not_to have_css(js_dropdown_label)
- expect_tokens([{ 'Name' => 'label', 'Value' => "~'#{wont_fix_label.title}'" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'label', value: "~'#{wont_fix_label.title}'" }])
+ expect_filtered_search_input_empty
end
it 'fills in the label name with the correct capitalization' do
click_label(uppercase_label.title)
expect(page).not_to have_css(js_dropdown_label)
- expect_tokens([{ 'Name' => 'label', 'Value' => "~#{uppercase_label.title}" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'label', value: "~#{uppercase_label.title}" }])
+ expect_filtered_search_input_empty
end
it 'fills in the label name with special characters' do
click_label(special_label.title)
expect(page).not_to have_css(js_dropdown_label)
- expect_tokens([{ 'Name' => 'label', 'Value' => "~#{special_label.title}" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'label', value: "~#{special_label.title}" }])
+ expect_filtered_search_input_empty
end
it 'selects `no label`' do
find("#{js_dropdown_label} .filter-dropdown-item", text: 'No Label').click
expect(page).not_to have_css(js_dropdown_label)
- expect_tokens([{ 'Name' => 'label', 'Value' => 'none' }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'label', value: 'none' }])
+ expect_filtered_search_input_empty
end
end
diff --git a/spec/features/issues/filtered_search/dropdown_milestone_spec.rb b/spec/features/issues/filtered_search/dropdown_milestone_spec.rb
index a83ce8fe020..0324fcad0a0 100644
--- a/spec/features/issues/filtered_search/dropdown_milestone_spec.rb
+++ b/spec/features/issues/filtered_search/dropdown_milestone_spec.rb
@@ -128,8 +128,8 @@ describe 'Dropdown milestone', js: true, feature: true do
click_milestone(milestone.title)
expect(page).to have_css(js_dropdown_milestone, visible: false)
- expect_tokens([{ 'Name' => 'milestone', 'Value' => "%#{milestone.title}" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'milestone', value: "%#{milestone.title}" }])
+ expect_filtered_search_input_empty
end
it 'fills in the milestone name when the milestone is partially filled' do
@@ -137,64 +137,64 @@ describe 'Dropdown milestone', js: true, feature: true do
click_milestone(milestone.title)
expect(page).to have_css(js_dropdown_milestone, visible: false)
- expect_tokens([{ 'Name' => 'milestone', 'Value' => "%#{milestone.title}" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'milestone', value: "%#{milestone.title}" }])
+ expect_filtered_search_input_empty
end
it 'fills in the milestone name that contains multiple words' do
click_milestone(two_words_milestone.title)
expect(page).to have_css(js_dropdown_milestone, visible: false)
- expect_tokens([{ 'Name' => 'milestone', 'Value' => "%\"#{two_words_milestone.title}\"" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'milestone', value: "%\"#{two_words_milestone.title}\"" }])
+ expect_filtered_search_input_empty
end
it 'fills in the milestone name that contains multiple words and is very long' do
click_milestone(long_milestone.title)
expect(page).to have_css(js_dropdown_milestone, visible: false)
- expect_tokens([{ 'Name' => 'milestone', 'Value' => "%\"#{long_milestone.title}\"" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'milestone', value: "%\"#{long_milestone.title}\"" }])
+ expect_filtered_search_input_empty
end
it 'fills in the milestone name that contains double quotes' do
click_milestone(wont_fix_milestone.title)
expect(page).to have_css(js_dropdown_milestone, visible: false)
- expect_tokens([{ 'Name' => 'milestone', 'Value' => "%'#{wont_fix_milestone.title}'" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'milestone', value: "%'#{wont_fix_milestone.title}'" }])
+ expect_filtered_search_input_empty
end
it 'fills in the milestone name with the correct capitalization' do
click_milestone(uppercase_milestone.title)
expect(page).to have_css(js_dropdown_milestone, visible: false)
- expect_tokens([{ 'Name' => 'milestone', 'Value' => "%#{uppercase_milestone.title}" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'milestone', value: "%#{uppercase_milestone.title}" }])
+ expect_filtered_search_input_empty
end
it 'fills in the milestone name with special characters' do
click_milestone(special_milestone.title)
expect(page).to have_css(js_dropdown_milestone, visible: false)
- expect_tokens([{ 'Name' => 'milestone', 'Value' => "%#{special_milestone.title}" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'milestone', value: "%#{special_milestone.title}" }])
+ expect_filtered_search_input_empty
end
it 'selects `no milestone`' do
click_static_milestone('No Milestone')
expect(page).to have_css(js_dropdown_milestone, visible: false)
- expect_tokens([{ 'Name' => 'milestone', 'Value' => 'none' }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'milestone', value: 'none' }])
+ expect_filtered_search_input_empty
end
it 'selects `upcoming milestone`' do
click_static_milestone('Upcoming')
expect(page).to have_css(js_dropdown_milestone, visible: false)
- expect_tokens([{ 'Name' => 'milestone', 'Value' => 'upcoming' }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'milestone', value: 'upcoming' }])
+ expect_filtered_search_input_empty
end
end
diff --git a/spec/features/issues/filtered_search/filter_issues_spec.rb b/spec/features/issues/filtered_search/filter_issues_spec.rb
index 66a14dbe8f6..56d656aead0 100644
--- a/spec/features/issues/filtered_search/filter_issues_spec.rb
+++ b/spec/features/issues/filtered_search/filter_issues_spec.rb
@@ -97,9 +97,9 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched author' do
input_filtered_search("author:@#{user.username}")
- expect_tokens([{ 'Name' => 'author', 'Value' => user.username }])
+ expect_tokens([{ name: 'author', value: user.username }])
expect_issues_list_count(5)
- expect_filtered_search_input_empty()
+ expect_filtered_search_input_empty
end
it 'filters issues by invalid author' do
@@ -117,7 +117,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched author and text' do
input_filtered_search("author:@#{user.username} #{search_term}")
- expect_tokens([{ 'Name' => 'author', 'Value' => user.username }])
+ expect_tokens([{ name: 'author', value: user.username }])
expect_issues_list_count(3)
expect_filtered_search_input(search_term)
end
@@ -126,8 +126,8 @@ describe 'Filter issues', js: true, feature: true do
input_filtered_search("author:@#{user.username} assignee:@#{user.username} #{search_term}")
expect_tokens([
- { 'Name' => 'author', 'Value' => user.username },
- { 'Name' => 'assignee', 'Value' => user.username }
+ { name: 'author', value: user.username },
+ { name: 'assignee', value: user.username }
])
expect_issues_list_count(3)
expect_filtered_search_input(search_term)
@@ -137,9 +137,9 @@ describe 'Filter issues', js: true, feature: true do
input_filtered_search("author:@#{user.username} assignee:@#{user.username} label:~#{caps_sensitive_label.title} #{search_term}")
expect_tokens([
- { 'Name' => 'author', 'Value' => user.username },
- { 'Name' => 'assignee', 'Value' => user.username },
- { 'Name' => 'label', 'Value' => caps_sensitive_label.title }
+ { name: 'author', value: user.username },
+ { name: 'assignee', value: user.username },
+ { name: 'label', value: caps_sensitive_label.title }
])
expect_issues_list_count(1)
expect_filtered_search_input(search_term)
@@ -149,10 +149,10 @@ describe 'Filter issues', js: true, feature: true do
input_filtered_search("author:@#{user.username} assignee:@#{user.username} label:~#{caps_sensitive_label.title} milestone:%#{milestone.title} #{search_term}")
expect_tokens([
- { 'Name' => 'author', 'Value' => user.username },
- { 'Name' => 'assignee', 'Value' => user.username },
- { 'Name' => 'label', 'Value' => caps_sensitive_label.title },
- { 'Name' => 'milestone', 'Value' => milestone.title }
+ { name: 'author', value: user.username },
+ { name: 'assignee', value: user.username },
+ { name: 'label', value: caps_sensitive_label.title },
+ { name: 'milestone', value: milestone.title }
])
expect_issues_list_count(1)
expect_filtered_search_input(search_term)
@@ -169,17 +169,17 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched assignee' do
input_filtered_search("assignee:@#{user.username}")
- expect_tokens([{ 'Name' => 'assignee', 'Value' => user.username }])
+ expect_tokens([{ name: 'assignee', value: user.username }])
expect_issues_list_count(5)
- expect_filtered_search_input_empty()
+ expect_filtered_search_input_empty
end
it 'filters issues by no assignee' do
input_filtered_search('assignee:none')
- expect_tokens([{ 'Name' => 'assignee', 'Value' => 'none' }])
+ expect_tokens([{ name: 'assignee', value: 'none' }])
expect_issues_list_count(8, 1)
- expect_filtered_search_input_empty()
+ expect_filtered_search_input_empty
end
it 'filters issues by invalid assignee' do
@@ -192,12 +192,12 @@ describe 'Filter issues', js: true, feature: true do
end
context 'assignee with other filters' do
- search_term = 'searchTerm'
+ let(:search_term) { 'searchTerm' }
it 'filters issues by searched assignee and text' do
input_filtered_search("assignee:@#{user.username} #{search_term}")
- expect_tokens([{ 'Name' => 'assignee', 'Value' => user.username }])
+ expect_tokens([{ name: 'assignee', value: user.username }])
expect_issues_list_count(2)
expect_filtered_search_input(search_term)
end
@@ -206,8 +206,8 @@ describe 'Filter issues', js: true, feature: true do
input_filtered_search("assignee:@#{user.username} author:@#{user.username} #{search_term}")
expect_tokens([
- { 'Name' => 'assignee', 'Value' => user.username },
- { 'Name' => 'author', 'Value' => user.username }
+ { name: 'assignee', value: user.username },
+ { name: 'author', value: user.username }
])
expect_issues_list_count(2)
expect_filtered_search_input(search_term)
@@ -217,9 +217,9 @@ describe 'Filter issues', js: true, feature: true do
input_filtered_search("assignee:@#{user.username} author:@#{user.username} label:~#{caps_sensitive_label.title} #{search_term}")
expect_tokens([
- { 'Name' => 'assignee', 'Value' => user.username },
- { 'Name' => 'author', 'Value' => user.username },
- { 'Name' => 'label', 'Value' => caps_sensitive_label.title }
+ { name: 'assignee', value: user.username },
+ { name: 'author', value: user.username },
+ { name: 'label', value: caps_sensitive_label.title }
])
expect_issues_list_count(1)
expect_filtered_search_input(search_term)
@@ -229,10 +229,10 @@ describe 'Filter issues', js: true, feature: true do
input_filtered_search("assignee:@#{user.username} author:@#{user.username} label:~#{caps_sensitive_label.title} milestone:%#{milestone.title} #{search_term}")
expect_tokens([
- { 'Name' => 'assignee', 'Value' => user.username },
- { 'Name' => 'author', 'Value' => user.username },
- { 'Name' => 'label', 'Value' => caps_sensitive_label.title },
- { 'Name' => 'milestone', 'Value' => milestone.title }
+ { name: 'assignee', value: user.username },
+ { name: 'author', value: user.username },
+ { name: 'label', value: caps_sensitive_label.title },
+ { name: 'milestone', value: milestone.title }
])
expect_issues_list_count(1)
expect_filtered_search_input(search_term)
@@ -247,23 +247,23 @@ describe 'Filter issues', js: true, feature: true do
end
describe 'filter issues by label' do
- search_term = 'bug'
+ let(:search_term) { 'bug' }
context 'only label' do
it 'filters issues by searched label' do
input_filtered_search("label:~#{bug_label.title}")
- expect_tokens([{ 'Name' => 'label', 'Value' => bug_label.title }])
+ expect_tokens([{ name: 'label', value: bug_label.title }])
expect_issues_list_count(2)
- expect_filtered_search_input_empty()
+ expect_filtered_search_input_empty
end
it 'filters issues by no label' do
input_filtered_search('label:none')
- expect_tokens([{ 'Name' => 'label', 'Value' => 'none' }])
+ expect_tokens([{ name: 'label', value: 'none' }])
expect_issues_list_count(9, 1)
- expect_filtered_search_input_empty()
+ expect_filtered_search_input_empty
end
it 'filters issues by invalid label' do
@@ -274,11 +274,11 @@ describe 'Filter issues', js: true, feature: true do
input_filtered_search("label:~#{bug_label.title} label:~#{caps_sensitive_label.title}")
expect_tokens([
- { 'Name' => 'label', 'Value' => bug_label.title },
- { 'Name' => 'label', 'Value' => caps_sensitive_label.title }
+ { name: 'label', value: bug_label.title },
+ { name: 'label', value: caps_sensitive_label.title }
])
expect_issues_list_count(1)
- expect_filtered_search_input_empty()
+ expect_filtered_search_input_empty
end
it 'filters issues by label containing special characters' do
@@ -287,9 +287,9 @@ describe 'Filter issues', js: true, feature: true do
special_issue.labels << special_label
input_filtered_search("label:~#{special_label.title}")
- expect_tokens([{ 'Name' => 'label', 'Value' => special_label.title }])
+ expect_tokens([{ name: 'label', value: special_label.title }])
expect_issues_list_count(1)
- expect_filtered_search_input_empty()
+ expect_filtered_search_input_empty
end
it 'does not show issues' do
@@ -297,9 +297,9 @@ describe 'Filter issues', js: true, feature: true do
input_filtered_search("label:~#{new_label.title}")
- expect_tokens([{ 'Name' => 'label', 'Value' => new_label.title }])
+ expect_tokens([{ name: 'label', value: new_label.title }])
expect_no_issues_list()
- expect_filtered_search_input_empty()
+ expect_filtered_search_input_empty
end
end
@@ -312,26 +312,26 @@ describe 'Filter issues', js: true, feature: true do
input_filtered_search("label:~'#{special_multiple_label.title}'")
# filtered search defaults quotations to double quotes
- expect_tokens([{ 'Name' => 'label', 'Value' => "\"#{special_multiple_label.title}\"" }])
+ expect_tokens([{ name: 'label', value: "\"#{special_multiple_label.title}\"" }])
expect_issues_list_count(1)
- expect_filtered_search_input_empty()
+ expect_filtered_search_input_empty
end
it 'single quotes' do
input_filtered_search("label:~'#{multiple_words_label.title}'")
- expect_tokens([{ 'Name' => 'label', 'Value' => "\"#{multiple_words_label.title}\"" }])
+ expect_tokens([{ name: 'label', value: "\"#{multiple_words_label.title}\"" }])
expect_issues_list_count(1)
- expect_filtered_search_input_empty()
+ expect_filtered_search_input_empty
end
it 'double quotes' do
input_filtered_search("label:~\"#{multiple_words_label.title}\"")
- expect_tokens([{ 'Name' => 'label', 'Value' => "\"#{multiple_words_label.title}\"" }])
+ expect_tokens([{ name: 'label', value: "\"#{multiple_words_label.title}\"" }])
expect_issues_list_count(1)
- expect_filtered_search_input_empty()
+ expect_filtered_search_input_empty
end
it 'single quotes containing double quotes' do
@@ -341,9 +341,9 @@ describe 'Filter issues', js: true, feature: true do
input_filtered_search("label:~'#{double_quotes_label.title}'")
- expect_tokens([{ 'Name' => 'label', 'Value' => "'#{double_quotes_label.title}'" }])
+ expect_tokens([{ name: 'label', value: "'#{double_quotes_label.title}'" }])
expect_issues_list_count(1)
- expect_filtered_search_input_empty()
+ expect_filtered_search_input_empty
end
it 'double quotes containing single quotes' do
@@ -353,9 +353,9 @@ describe 'Filter issues', js: true, feature: true do
input_filtered_search("label:~\"#{single_quotes_label.title}\"")
- expect_tokens([{ 'Name' => 'label', 'Value' => "\"#{single_quotes_label.title}\"" }])
+ expect_tokens([{ name: 'label', value: "\"#{single_quotes_label.title}\"" }])
expect_issues_list_count(1)
- expect_filtered_search_input_empty()
+ expect_filtered_search_input_empty
end
end
@@ -363,7 +363,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched label and text' do
input_filtered_search("label:~#{caps_sensitive_label.title} #{search_term}")
- expect_tokens([{ 'Name' => 'label', 'Value' => caps_sensitive_label.title }])
+ expect_tokens([{ name: 'label', value: caps_sensitive_label.title }])
expect_issues_list_count(1)
expect_filtered_search_input(search_term)
end
@@ -372,8 +372,8 @@ describe 'Filter issues', js: true, feature: true do
input_filtered_search("label:~#{caps_sensitive_label.title} author:@#{user.username} #{search_term}")
expect_tokens([
- { 'Name' => 'label', 'Value' => caps_sensitive_label.title },
- { 'Name' => 'author', 'Value' => user.username }
+ { name: 'label', value: caps_sensitive_label.title },
+ { name: 'author', value: user.username }
])
expect_issues_list_count(1)
expect_filtered_search_input(search_term)
@@ -383,9 +383,9 @@ describe 'Filter issues', js: true, feature: true do
input_filtered_search("label:~#{caps_sensitive_label.title} author:@#{user.username} assignee:@#{user.username} #{search_term}")
expect_tokens([
- { 'Name' => 'label', 'Value' => caps_sensitive_label.title },
- { 'Name' => 'author', 'Value' => user.username },
- { 'Name' => 'assignee', 'Value' => user.username }
+ { name: 'label', value: caps_sensitive_label.title },
+ { name: 'author', value: user.username },
+ { name: 'assignee', value: user.username }
])
expect_issues_list_count(1)
expect_filtered_search_input(search_term)
@@ -395,10 +395,10 @@ describe 'Filter issues', js: true, feature: true do
input_filtered_search("label:~#{caps_sensitive_label.title} author:@#{user.username} assignee:@#{user.username} milestone:%#{milestone.title} #{search_term}")
expect_tokens([
- { 'Name' => 'label', 'Value' => caps_sensitive_label.title },
- { 'Name' => 'author', 'Value' => user.username },
- { 'Name' => 'assignee', 'Value' => user.username },
- { 'Name' => 'milestone', 'Value' => milestone.title }
+ { name: 'label', value: caps_sensitive_label.title },
+ { name: 'author', value: user.username },
+ { name: 'assignee', value: user.username },
+ { name: 'milestone', value: milestone.title }
])
expect_issues_list_count(1)
expect_filtered_search_input(search_term)
@@ -410,8 +410,8 @@ describe 'Filter issues', js: true, feature: true do
input_filtered_search("label:~#{bug_label.title} label:~#{caps_sensitive_label.title} #{search_term}")
expect_tokens([
- { 'Name' => 'label', 'Value' => bug_label.title },
- { 'Name' => 'label', 'Value' => caps_sensitive_label.title }
+ { name: 'label', value: bug_label.title },
+ { name: 'label', value: caps_sensitive_label.title }
])
expect_issues_list_count(1)
expect_filtered_search_input(search_term)
@@ -421,9 +421,9 @@ describe 'Filter issues', js: true, feature: true do
input_filtered_search("label:~#{bug_label.title} label:~#{caps_sensitive_label.title} author:@#{user.username} #{search_term}")
expect_tokens([
- { 'Name' => 'label', 'Value' => bug_label.title },
- { 'Name' => 'label', 'Value' => caps_sensitive_label.title },
- { 'Name' => 'author', 'Value' => user.username }
+ { name: 'label', value: bug_label.title },
+ { name: 'label', value: caps_sensitive_label.title },
+ { name: 'author', value: user.username }
])
expect_issues_list_count(1)
expect_filtered_search_input(search_term)
@@ -433,10 +433,10 @@ describe 'Filter issues', js: true, feature: true do
input_filtered_search("label:~#{bug_label.title} label:~#{caps_sensitive_label.title} author:@#{user.username} assignee:@#{user.username} #{search_term}")
expect_tokens([
- { 'Name' => 'label', 'Value' => bug_label.title },
- { 'Name' => 'label', 'Value' => caps_sensitive_label.title },
- { 'Name' => 'author', 'Value' => user.username },
- { 'Name' => 'assignee', 'Value' => user.username }
+ { name: 'label', value: bug_label.title },
+ { name: 'label', value: caps_sensitive_label.title },
+ { name: 'author', value: user.username },
+ { name: 'assignee', value: user.username }
])
expect_issues_list_count(1)
expect_filtered_search_input(search_term)
@@ -446,11 +446,11 @@ describe 'Filter issues', js: true, feature: true do
input_filtered_search("label:~#{bug_label.title} label:~#{caps_sensitive_label.title} author:@#{user.username} assignee:@#{user.username} milestone:%#{milestone.title} #{search_term}")
expect_tokens([
- { 'Name' => 'label', 'Value' => bug_label.title },
- { 'Name' => 'label', 'Value' => caps_sensitive_label.title },
- { 'Name' => 'author', 'Value' => user.username },
- { 'Name' => 'assignee', 'Value' => user.username },
- { 'Name' => 'milestone', 'Value' => milestone.title }
+ { name: 'label', value: bug_label.title },
+ { name: 'label', value: caps_sensitive_label.title },
+ { name: 'author', value: user.username },
+ { name: 'assignee', value: user.username },
+ { name: 'milestone', value: milestone.title }
])
expect_issues_list_count(1)
expect_filtered_search_input(search_term)
@@ -467,8 +467,8 @@ describe 'Filter issues', js: true, feature: true do
end
it 'displays in search bar' do
- expect_tokens([{ 'Name' => 'label', 'Value' => "\"#{multiple_words_label.title}\"" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'label', value: "\"#{multiple_words_label.title}\"" }])
+ expect_filtered_search_input_empty
end
end
@@ -484,25 +484,25 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched milestone' do
input_filtered_search("milestone:%#{milestone.title}")
- expect_tokens([{ 'Name' => 'milestone', 'Value' => milestone.title }])
+ expect_tokens([{ name: 'milestone', value: milestone.title }])
expect_issues_list_count(5)
- expect_filtered_search_input_empty()
+ expect_filtered_search_input_empty
end
it 'filters issues by no milestone' do
input_filtered_search("milestone:none")
- expect_tokens([{ 'Name' => 'milestone', 'Value' => 'none' }])
+ expect_tokens([{ name: 'milestone', value: 'none' }])
expect_issues_list_count(7, 1)
- expect_filtered_search_input_empty()
+ expect_filtered_search_input_empty
end
it 'filters issues by upcoming milestones' do
input_filtered_search("milestone:upcoming")
- expect_tokens([{ 'Name' => 'milestone', 'Value' => 'upcoming' }])
+ expect_tokens([{ name: 'milestone', value: 'upcoming' }])
expect_issues_list_count(1)
- expect_filtered_search_input_empty()
+ expect_filtered_search_input_empty
end
it 'filters issues by invalid milestones' do
@@ -519,9 +519,9 @@ describe 'Filter issues', js: true, feature: true do
input_filtered_search("milestone:%#{special_milestone.title}")
- expect_tokens([{ 'Name' => 'milestone', 'Value' => special_milestone.title }])
+ expect_tokens([{ name: 'milestone', value: special_milestone.title }])
expect_issues_list_count(1)
- expect_filtered_search_input_empty()
+ expect_filtered_search_input_empty
end
it 'does not show issues' do
@@ -529,9 +529,9 @@ describe 'Filter issues', js: true, feature: true do
input_filtered_search("milestone:%#{new_milestone.title}")
- expect_tokens([{ 'Name' => 'milestone', 'Value' => new_milestone.title }])
+ expect_tokens([{ name: 'milestone', value: new_milestone.title }])
expect_no_issues_list()
- expect_filtered_search_input_empty()
+ expect_filtered_search_input_empty
end
end
@@ -541,7 +541,7 @@ describe 'Filter issues', js: true, feature: true do
it 'filters issues by searched milestone and text' do
input_filtered_search("milestone:%#{milestone.title} #{search_term}")
- expect_tokens([{ 'Name' => 'milestone', 'Value' => milestone.title }])
+ expect_tokens([{ name: 'milestone', value: milestone.title }])
expect_issues_list_count(2)
expect_filtered_search_input(search_term)
end
@@ -550,8 +550,8 @@ describe 'Filter issues', js: true, feature: true do
input_filtered_search("milestone:%#{milestone.title} author:@#{user.username} #{search_term}")
expect_tokens([
- { 'Name' => 'milestone', 'Value' => milestone.title },
- { 'Name' => 'author', 'Value' => user.username }
+ { name: 'milestone', value: milestone.title },
+ { name: 'author', value: user.username }
])
expect_issues_list_count(2)
expect_filtered_search_input(search_term)
@@ -561,9 +561,9 @@ describe 'Filter issues', js: true, feature: true do
input_filtered_search("milestone:%#{milestone.title} author:@#{user.username} assignee:@#{user.username} #{search_term}")
expect_tokens([
- { 'Name' => 'milestone', 'Value' => milestone.title },
- { 'Name' => 'author', 'Value' => user.username },
- { 'Name' => 'assignee', 'Value' => user.username }
+ { name: 'milestone', value: milestone.title },
+ { name: 'author', value: user.username },
+ { name: 'assignee', value: user.username }
])
expect_issues_list_count(2)
expect_filtered_search_input(search_term)
@@ -573,10 +573,10 @@ describe 'Filter issues', js: true, feature: true do
input_filtered_search("milestone:%#{milestone.title} author:@#{user.username} assignee:@#{user.username} label:~#{bug_label.title} #{search_term}")
expect_tokens([
- { 'Name' => 'milestone', 'Value' => milestone.title },
- { 'Name' => 'author', 'Value' => user.username },
- { 'Name' => 'assignee', 'Value' => user.username },
- { 'Name' => 'label', 'Value' => bug_label.title }
+ { name: 'milestone', value: milestone.title },
+ { name: 'author', value: user.username },
+ { name: 'assignee', value: user.username },
+ { name: 'label', value: bug_label.title }
])
expect_issues_list_count(2)
expect_filtered_search_input(search_term)
@@ -601,8 +601,8 @@ describe 'Filter issues', js: true, feature: true do
click_button user2.username
end
- expect_tokens([{ 'Name' => 'author', 'Value' => user2.username }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'author', value: user2.username }])
+ expect_filtered_search_input_empty
end
it 'changes label' do
@@ -616,10 +616,10 @@ describe 'Filter issues', js: true, feature: true do
end
expect_tokens([
- { 'Name' => 'author', 'Value' => user.username },
- { 'Name' => 'label', 'Value' => label.name }
+ { name: 'author', value: user.username },
+ { name: 'label', value: label.name }
])
- expect_filtered_search_input_empty()
+ expect_filtered_search_input_empty
end
it 'changes label correctly space is in previous label' do
@@ -632,8 +632,8 @@ describe 'Filter issues', js: true, feature: true do
click_button label.name
end
- expect_tokens([{ 'Name' => 'label', 'Value' => label.name }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'label', value: label.name }])
+ expect_filtered_search_input_empty
end
end
diff --git a/spec/features/issues/filtered_search/search_bar_spec.rb b/spec/features/issues/filtered_search/search_bar_spec.rb
index cb802578037..59244d65eec 100644
--- a/spec/features/issues/filtered_search/search_bar_spec.rb
+++ b/spec/features/issues/filtered_search/search_bar_spec.rb
@@ -33,8 +33,8 @@ describe 'Search bar', js: true, feature: true do
it 'selects item' do
filtered_search.native.send_keys(:down, :down, :enter)
- expect_tokens([{ 'Name' => 'author' }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'author' }])
+ expect_filtered_search_input_empty
end
end
diff --git a/spec/features/merge_requests/filter_by_milestone_spec.rb b/spec/features/merge_requests/filter_by_milestone_spec.rb
index c98cccf655b..265a0cfc198 100644
--- a/spec/features/merge_requests/filter_by_milestone_spec.rb
+++ b/spec/features/merge_requests/filter_by_milestone_spec.rb
@@ -25,8 +25,8 @@ feature 'Merge Request filtering by Milestone', feature: true do
visit_merge_requests(project)
input_filtered_search('milestone:none')
- expect_tokens([{ 'Name' => 'milestone', 'Value' => 'none' }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'milestone', value: 'none' }])
+ expect_filtered_search_input_empty
expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1)
expect(page).to have_css('.merge-request', count: 1)
diff --git a/spec/features/merge_requests/filter_merge_requests_spec.rb b/spec/features/merge_requests/filter_merge_requests_spec.rb
index 7b64e347094..70e3997e716 100644
--- a/spec/features/merge_requests/filter_merge_requests_spec.rb
+++ b/spec/features/merge_requests/filter_merge_requests_spec.rb
@@ -25,8 +25,8 @@ describe 'Filter merge requests', feature: true do
let(:search_query) { "assignee:@#{user.username}" }
def expect_assignee_visual_tokens
- expect_tokens([{ 'Name' => 'assignee', 'Value' => "@#{user.username}" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'assignee', value: "@#{user.username}" }])
+ expect_filtered_search_input_empty
end
before do
@@ -58,8 +58,8 @@ describe 'Filter merge requests', feature: true do
let(:search_query) { "milestone:%\"#{milestone.title}\"" }
def expect_milestone_visual_tokens
- expect_tokens([{ 'Name' => 'milestone', 'Value' => "%\"#{milestone.title}\"" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'milestone', value: "%\"#{milestone.title}\"" }])
+ expect_filtered_search_input_empty
end
before do
@@ -92,16 +92,16 @@ describe 'Filter merge requests', feature: true do
input_filtered_search('label:none')
expect_mr_list_count(1)
- expect_tokens([{ 'Name' => 'label', 'Value' => 'none' }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'label', value: 'none' }])
+ expect_filtered_search_input_empty
end
it 'filters by a label' do
input_filtered_search("label:~#{label.title}")
expect_mr_list_count(0)
- expect_tokens([{ 'Name' => 'label', 'Value' => "~#{label.title}" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'label', value: "~#{label.title}" }])
+ expect_filtered_search_input_empty
end
it "filters by `won't fix` and another label" do
@@ -109,27 +109,27 @@ describe 'Filter merge requests', feature: true do
expect_mr_list_count(0)
expect_tokens([
- { 'Name' => 'label', 'Value' => "~\"#{wontfix.title}\"" },
- { 'Name' => 'label', 'Value' => "~#{label.title}" }
+ { name: 'label', value: "~\"#{wontfix.title}\"" },
+ { name: 'label', value: "~#{label.title}" }
])
- expect_filtered_search_input_empty()
+ expect_filtered_search_input_empty
end
it "filters by `won't fix` label followed by another label after page load" do
input_filtered_search("label:~\"#{wontfix.title}\"")
expect_mr_list_count(0)
- expect_tokens([{ 'Name' => 'label', 'Value' => "~\"#{wontfix.title}\"" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'label', value: "~\"#{wontfix.title}\"" }])
+ expect_filtered_search_input_empty
input_filtered_search_keys("label:~#{label.title}")
expect_mr_list_count(0)
expect_tokens([
- { 'Name' => 'label', 'Value' => "~\"#{wontfix.title}\"" },
- { 'Name' => 'label', 'Value' => "~#{label.title}" }
+ { name: 'label', value: "~\"#{wontfix.title}\"" },
+ { name: 'label', value: "~#{label.title}" }
])
- expect_filtered_search_input_empty()
+ expect_filtered_search_input_empty
end
end
@@ -140,8 +140,8 @@ describe 'Filter merge requests', feature: true do
input_filtered_search("assignee:@#{user.username}")
expect_mr_list_count(1)
- expect_tokens([{ 'Name' => 'assignee', 'Value' => "@#{user.username}" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'assignee', value: "@#{user.username}" }])
+ expect_filtered_search_input_empty
input_filtered_search_keys("label:~#{label.title} ")
@@ -153,10 +153,10 @@ describe 'Filter merge requests', feature: true do
context 'assignee and label', js: true do
def expect_assignee_label_visual_tokens
expect_tokens([
- { 'Name' => 'assignee', 'Value' => "@#{user.username}" },
- { 'Name' => 'label', 'Value' => "~#{label.title}" }
+ { name: 'assignee', value: "@#{user.username}" },
+ { name: 'label', value: "~#{label.title}" }
])
- expect_filtered_search_input_empty()
+ expect_filtered_search_input_empty
end
it 'updates to current assignee and label' do
@@ -223,7 +223,7 @@ describe 'Filter merge requests', feature: true do
input_filtered_search_keys(' label:~bug')
expect_mr_list_count(1)
- expect_tokens([{ 'Name' => 'label', 'Value' => '~bug' }])
+ expect_tokens([{ name: 'label', value: '~bug' }])
expect_filtered_search_input('Bug')
end
@@ -236,7 +236,7 @@ describe 'Filter merge requests', feature: true do
input_filtered_search_keys(' milestone:%8')
expect_mr_list_count(1)
- expect_tokens([{ 'Name' => 'milestone', 'Value' => '%8' }])
+ expect_tokens([{ name: 'milestone', value: '%8' }])
expect_filtered_search_input('Bug')
end
@@ -249,7 +249,7 @@ describe 'Filter merge requests', feature: true do
input_filtered_search_keys(" assignee:@#{user.username}")
expect_mr_list_count(1)
- expect_tokens([{ 'Name' => 'assignee', 'Value' => "@#{user.username}" }])
+ expect_tokens([{ name: 'assignee', value: "@#{user.username}" }])
expect_filtered_search_input('Bug')
end
@@ -262,7 +262,7 @@ describe 'Filter merge requests', feature: true do
input_filtered_search_keys(" author:@#{user.username}")
expect_mr_list_count(1)
- expect_tokens([{ 'Name' => 'author', 'Value' => "@#{user.username}" }])
+ expect_tokens([{ name: 'author', value: "@#{user.username}" }])
expect_filtered_search_input('Bug')
end
end
@@ -302,8 +302,8 @@ describe 'Filter merge requests', feature: true do
it 'filter by current user' do
visit namespace_project_merge_requests_path(project.namespace, project, assignee_id: user.id)
- expect_tokens([{ 'Name' => 'assignee', 'Value' => "@#{user.username}" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'assignee', value: "@#{user.username}" }])
+ expect_filtered_search_input_empty
end
it 'filter by new user' do
@@ -312,8 +312,8 @@ describe 'Filter merge requests', feature: true do
visit namespace_project_merge_requests_path(project.namespace, project, assignee_id: new_user.id)
- expect_tokens([{ 'Name' => 'assignee', 'Value' => "@#{new_user.username}" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'assignee', value: "@#{new_user.username}" }])
+ expect_filtered_search_input_empty
end
end
@@ -321,8 +321,8 @@ describe 'Filter merge requests', feature: true do
it 'filter by current user' do
visit namespace_project_merge_requests_path(project.namespace, project, author_id: user.id)
- expect_tokens([{ 'Name' => 'author', 'Value' => "@#{user.username}" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'author', value: "@#{user.username}" }])
+ expect_filtered_search_input_empty
end
it 'filter by new user' do
@@ -331,8 +331,8 @@ describe 'Filter merge requests', feature: true do
visit namespace_project_merge_requests_path(project.namespace, project, author_id: new_user.id)
- expect_tokens([{ 'Name' => 'author', 'Value' => "@#{new_user.username}" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'author', value: "@#{new_user.username}" }])
+ expect_filtered_search_input_empty
end
end
end
diff --git a/spec/features/search_spec.rb b/spec/features/search_spec.rb
index e6fc2a9f0f2..a6560a81096 100644
--- a/spec/features/search_spec.rb
+++ b/spec/features/search_spec.rb
@@ -171,8 +171,8 @@ describe "Search", feature: true do
sleep 2
expect(page).to have_selector('.filtered-search')
- expect_tokens([{ 'Name' => 'assignee', 'Value' => "@#{user.username}" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'assignee', value: "@#{user.username}" }])
+ expect_filtered_search_input_empty
end
it 'takes user to her issues page when issues authored is clicked' do
@@ -180,8 +180,8 @@ describe "Search", feature: true do
sleep 2
expect(page).to have_selector('.filtered-search')
- expect_tokens([{ 'Name' => 'author', 'Value' => "@#{user.username}" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'author', value: "@#{user.username}" }])
+ expect_filtered_search_input_empty
end
it 'takes user to her MR page when MR assigned is clicked' do
@@ -189,8 +189,8 @@ describe "Search", feature: true do
sleep 2
expect(page).to have_selector('.merge-requests-holder')
- expect_tokens([{ 'Name' => 'assignee', 'Value' => "@#{user.username}" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'assignee', value: "@#{user.username}" }])
+ expect_filtered_search_input_empty
end
it 'takes user to her MR page when MR authored is clicked' do
@@ -198,8 +198,8 @@ describe "Search", feature: true do
sleep 2
expect(page).to have_selector('.merge-requests-holder')
- expect_tokens([{ 'Name' => 'author', 'Value' => "@#{user.username}" }])
- expect_filtered_search_input_empty()
+ expect_tokens([{ name: 'author', value: "@#{user.username}" }])
+ expect_filtered_search_input_empty
end
end
diff --git a/spec/support/filtered_search_helpers.rb b/spec/support/filtered_search_helpers.rb
index f43379f258e..a6942c65933 100644
--- a/spec/support/filtered_search_helpers.rb
+++ b/spec/support/filtered_search_helpers.rb
@@ -3,7 +3,9 @@ module FilteredSearchHelpers
page.find('.filtered-search')
end
+ # Enables input to be set (similar to copy and paste)
def input_filtered_search(search_term, submit: true)
+ # Add an extra space to engage visual tokens
filtered_search.set("#{search_term} ")
if submit
@@ -11,7 +13,9 @@ module FilteredSearchHelpers
end
end
+ # Enables input to be added character by character
def input_filtered_search_keys(search_term)
+ # Add an extra space to engage visual tokens
filtered_search.send_keys("#{search_term} ")
filtered_search.send_keys(:enter)
end
@@ -39,11 +43,13 @@ module FilteredSearchHelpers
expect(find('.filtered-search').value).to eq('')
end
+ # Iterates through each visual token inside
+ # .tokens-container to make sure the correct names and values are rendered
def expect_tokens(tokens)
page.find '.filtered-search-input-container .tokens-container' do
page.all(:css, '.tokens-container li').each_with_index do |el, index|
- token_name = tokens[index]['Name']
- token_value = tokens[index]['Value']
+ token_name = tokens[index][:name]
+ token_value = tokens[index][:value]
expect(el.find('.name')).to have_content(token_name)
if token_value