diff options
| author | Zog | 2018-01-23 13:35:26 +0100 |
|---|---|---|
| committer | Zog | 2018-02-09 10:22:01 +0100 |
| commit | f114485e22c17239f3d7be06eb3bc1abffbbfe4b (patch) | |
| tree | 472ccf3316a6e30f7fb0db4d281ac8cef3c87e4c /spec/support | |
| parent | 590ff858cf0fe71b420f8a59d393319e190f68aa (diff) | |
| download | chouette-core-f114485e22c17239f3d7be06eb3bc1abffbbfe4b.tar.bz2 | |
Refs #5669 @1h; Set invariant values in the snapshots
Diffstat (limited to 'spec/support')
| -rw-r--r-- | spec/support/snapshot_support.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/support/snapshot_support.rb b/spec/support/snapshot_support.rb index c37bb075c..b1ade5288 100644 --- a/spec/support/snapshot_support.rb +++ b/spec/support/snapshot_support.rb @@ -1,3 +1,27 @@ +module SnaphostSpecHelper + + module Methods + def set_invariant expr, val=nil + val ||= expr + chain = expr.split(".") + method = chain.pop + + before(:each) do + allow(eval(chain.join('.'))).to receive(method){ val } + end + end + end + + def self.included into + into.extend Methods + end +end + +RSpec.configure do |config| + config.include SnaphostSpecHelper, type: :view +end + + RSpec::Matchers.define :match_actions_links_snapshot do |name| match do |actual| @content = Capybara::Node::Simple.new(rendered).find('.page_header').native.inner_html |
