Sha256: 2ccf389d7558daf781db029c75ffd6d85f0c856e4a64c364f8bd63247fbfeac3

Contents?: true

Size: 725 Bytes

Versions: 1

Compression:

Stored size: 725 Bytes

Contents

module Museo
  module RspecIntegration
    include TestIntegration

    def self.included(base)
      base.render_views
      base.extend(ClassMethods)
    end

    module ClassMethods
      def snapshot(description)
        it "matches snapshot: #{description}" do |example|
          begin
            _museo_setup

            instance_exec(example, &Proc.new)

            expect_matching_snapshot(example)
          ensure
            _museo_teardown
          end
        end
      end
    end

    def expect_matching_snapshot(example)
      expect(Snapshot::Rspec.new(self, example.metadata).body).to(
        eq(Snapshot.sanitize_response(response.body)),
        "Snapshot did not match",
      )
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
museo-0.1.0 lib/museo/rspec_integration.rb