aboutsummaryrefslogtreecommitdiffstats
path: root/spec/support
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/breadcrumb_features.rb15
-rw-r--r--spec/support/webmock/helpers.rb5
-rw-r--r--spec/support/with_commit.rb10
3 files changed, 30 insertions, 0 deletions
diff --git a/spec/support/breadcrumb_features.rb b/spec/support/breadcrumb_features.rb
new file mode 100644
index 000000000..36bfce19c
--- /dev/null
+++ b/spec/support/breadcrumb_features.rb
@@ -0,0 +1,15 @@
+module BreadcrumbFeatures
+ def expect_breadcrumb_links *link_names
+ within('.breadcrumbs') do
+ all('a').zip( link_names ).each do | link_element, link_content |
+ within(link_element) do | |
+ expect(page).to have_content(link_content)
+ end
+ end
+ end
+ end
+end
+
+RSpec.configure do | conf |
+ conf.include BreadcrumbFeatures, type: :feature
+end
diff --git a/spec/support/webmock/helpers.rb b/spec/support/webmock/helpers.rb
index fc6c77850..a6506c035 100644
--- a/spec/support/webmock/helpers.rb
+++ b/spec/support/webmock/helpers.rb
@@ -8,6 +8,11 @@ module Support
def make_headers(headers={}, authorization_token:)
headers.merge('Authorization' => "Token token=#{authorization_token.inspect}")
end
+
+ def with_stubbed_request( method, uri, &blk )
+ stub_request(method, uri).tap(&blk)
+ end
+
end
end
end
diff --git a/spec/support/with_commit.rb b/spec/support/with_commit.rb
new file mode 100644
index 000000000..2b4725f89
--- /dev/null
+++ b/spec/support/with_commit.rb
@@ -0,0 +1,10 @@
+module WithCommit
+ def with_commit
+ yield
+ subject._run_commit_callbacks
+ end
+end
+
+RSpec.configure do |conf|
+ conf.include WithCommit, type: :with_commit
+end