Sha256: 9bbb0ac2608b1b6e413d366589051e636a3704feaffae2d8edd5eaab11b68e39

Contents?: true

Size: 829 Bytes

Versions: 17

Compression:

Stored size: 829 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe 'Matcher.extract_attribute' do
  Dir[File.join(File.dirname(__FILE__), 'extract_attribute_data', '*.yml')].sort.each do |path|
    context File.basename(path) do
      specs = YAML.safe_load(File.read(path), aliases: true)

      specs.each do |spec|
        context spec['name'] do

          if spec['pending']
            pending spec['pending'].to_s
          end

          let(:document) do
            spec['document']
          end

          let(:key) { spec['key'] }

          let(:actual) do
            Mongoid::Matcher.extract_attribute(document, key)
          end

          let(:expected) { spec.fetch('result') }

          it 'has the expected result' do
            actual.should == expected
          end
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
mongoid-8.1.8 spec/mongoid/matcher/extract_attribute_spec.rb
mongoid-8.1.7 spec/mongoid/matcher/extract_attribute_spec.rb
mongoid-8.1.6 spec/mongoid/matcher/extract_attribute_spec.rb
mongoid-8.0.8 spec/mongoid/matcher/extract_attribute_spec.rb
mongoid-8.1.5 spec/mongoid/matcher/extract_attribute_spec.rb
mongoid-8.1.4 spec/mongoid/matcher/extract_attribute_spec.rb
mongoid-8.0.7 spec/mongoid/matcher/extract_attribute_spec.rb
mongoid-8.1.3 spec/mongoid/matcher/extract_attribute_spec.rb
mongoid-8.1.2 spec/mongoid/matcher/extract_attribute_spec.rb
mongoid-8.0.6 spec/mongoid/matcher/extract_attribute_spec.rb
mongoid-8.1.1 spec/mongoid/matcher/extract_attribute_spec.rb
mongoid-8.0.5 spec/mongoid/matcher/extract_attribute_spec.rb
mongoid-8.1.0 spec/mongoid/matcher/extract_attribute_spec.rb
mongoid-8.0.4 spec/mongoid/matcher/extract_attribute_spec.rb
mongoid-8.0.3 spec/mongoid/matcher/extract_attribute_spec.rb
mongoid-8.0.2 spec/mongoid/matcher/extract_attribute_spec.rb
mongoid-8.0.1 spec/mongoid/matcher/extract_attribute_spec.rb