Sha256: 09f199342c9de945f8175552a09c4dea7e1b74678b6f41c042bc8c91bb2005d8

Contents?: true

Size: 746 Bytes

Versions: 7

Compression:

Stored size: 746 Bytes

Contents

Feature: ActiveRecord::Relation match array

  The `match_array` matcher can be used with an `ActiveRecord::Relation`
  (scope). The assertion will pass if the scope would return all of the
  elements specified in the array on the right hand side.

  Scenario: example spec with relation match_array matcher
    Given a file named "spec/models/widget_spec.rb" with:
      """ruby
      require "spec_helper"

      describe Widget do
        let!(:widgets) { Array.new(3) { Widget.create } }
        subject { Widget.scoped }

        it "returns all widgets in any order" do
          expect(subject).to match_array(widgets)
        end
      end
      """
    When I run `rspec spec/models/widget_spec.rb`
    Then the examples should all pass

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/rspec-rails-2.13.0/features/matchers/relation_match_array.feature
rspec-rails-2.14.0 features/matchers/relation_match_array.feature
rspec-rails-2.13.1 features/matchers/relation_match_array.feature
rspec-rails-2.13.0 features/matchers/relation_match_array.feature
rspec-rails-2.12.2 features/matchers/relation_match_array.feature
rspec-rails-2.12.1 features/matchers/relation_match_array.feature
rspec-rails-2.12.0 features/matchers/relation_match_array.feature