Sha256: ca39d99f798757ff5486615c80ddfaf162559958fe3f0c59fa8a56d7648f1f1c

Contents?: true

Size: 762 Bytes

Versions: 2

Compression:

Stored size: 762 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)
      snapshot = Snapshot::Rspec.new(self, example.metadata)
      response_body = Snapshot.sanitize_response(response.body)

      expect(response_body).to eq(snapshot.body), "Snapshot did not match"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
museo-0.3.0 lib/museo/rspec_integration.rb
museo-0.2.0 lib/museo/rspec_integration.rb