Sha256: f231ebad85b60090ca28c7493e3aab84e95bf21339ed6423ddbe16ca493a74f7
Contents?: true
Size: 850 Bytes
Versions: 5
Compression:
Stored size: 850 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 } } if ::Rails::VERSION::STRING >= '4' subject { Widget.all } else subject { Widget.scoped } end 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
5 entries across 5 versions & 1 rubygems