diff options
author | blackst0ne <blackst0ne.ru@gmail.com> | 2018-04-03 10:27:56 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-04-03 10:27:56 +0000 |
commit | dc4ae317ea858952acd5c91dd8034832638b3794 (patch) | |
tree | 4f62604b27b0ec1ed9f35a509380372e0bdcb638 /spec/support/matchers | |
parent | 95b3bf26cae3c2e483df4591ec5fe492ab9746a5 (diff) | |
download | gitlab-ce-dc4ae317ea858952acd5c91dd8034832638b3794.tar.gz |
Replace the `project/issues/issues.feature` spinach test with an rspec analog
Diffstat (limited to 'spec/support/matchers')
-rw-r--r-- | spec/support/matchers/issuable_matchers.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/support/matchers/issuable_matchers.rb b/spec/support/matchers/issuable_matchers.rb new file mode 100644 index 00000000000..f5d9a97051a --- /dev/null +++ b/spec/support/matchers/issuable_matchers.rb @@ -0,0 +1,11 @@ +RSpec::Matchers.define :have_header_with_correct_id_and_link do |level, text, id, parent = ".wiki"| + match do |actual| + node = find("#{parent} h#{level} a#user-content-#{id}") + + expect(node[:href]).to end_with("##{id}") + + # Work around a weird Capybara behavior where calling `parent` on a node + # returns the whole document, not the node's actual parent element + expect(find(:xpath, "#{node.path}/..").text).to eq(text) + end +end |