Sha256: 48e34f5090c308b2177f99b14be333a368e4031da9b1f53f8c7c378bdcbba66a

Contents?: true

Size: 975 Bytes

Versions: 9

Compression:

Stored size: 975 Bytes

Contents

require 'rspec/expectations'
require 'draftjs_html/spec_support'

module DraftjsHtml
  module SpecSupport
    module RSpecMatchers
      extend RSpec::Matchers::DSL

      matcher :eq_raw_draftjs do |expected|
        include DraftjsHtml::SpecSupport::KeyNormalization
        match do |actual|
          @raw_draftjs = normalize_keys(DraftjsHtml::Draftjs::RawBuilder.build(&block_arg))
          @actual = normalize_keys(actual)

          values_match?(@raw_draftjs, @actual)
        end

        diffable

        def expected
          @raw_draftjs
        end
      end

      matcher :eq_raw_draftjs_ignoring_keys do |expected|
        include DraftjsHtml::SpecSupport::KeyNormalization
        match do |actual|
          @raw_draftjs = normalize_keys(expected)
          @actual = normalize_keys(actual)

          values_match?(@raw_draftjs, @actual)
        end

        diffable

        def expected
          @raw_draftjs
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
draftjs_html-0.34.0 lib/draftjs_html/spec_support/rspec.rb
draftjs_html-0.33.0 lib/draftjs_html/spec_support/rspec.rb
draftjs_html-0.32.0 lib/draftjs_html/spec_support/rspec.rb
draftjs_html-0.31.0 lib/draftjs_html/spec_support/rspec.rb
draftjs_html-0.30.0 lib/draftjs_html/spec_support/rspec.rb
draftjs_html-0.29.0 lib/draftjs_html/spec_support/rspec.rb
draftjs_html-0.28.0 lib/draftjs_html/spec_support/rspec.rb
draftjs_html-0.27.0 lib/draftjs_html/spec_support/rspec.rb
draftjs_html-0.26.0 lib/draftjs_html/spec_support/rspec.rb