Sha256: 16c6df40759ebd8b6f9aa84d83a4fc79c7391375d09d324c926ad07765508eff
Contents?: true
Size: 1.1 KB
Versions: 1
Compression:
Stored size: 1.1 KB
Contents
require "spec_helper" describe "ActiveSupport::Relation =~ matcher" do before { MockableModel.delete_all } let!(:models) { Array.new(3) { MockableModel.create } } if ::Rails::VERSION::STRING >= '4' it "verifies that the scope returns the records on the right hand side, regardless of order" do expect(MockableModel.all).to match_array(models.reverse) end it "fails if the scope encompasses more records than on the right hand side" do MockableModel.create expect(MockableModel.all).not_to match_array(models.reverse) end else it "verifies that the scope returns the records on the right hand side, regardless of order" do expect(MockableModel.scoped).to match_array(models.reverse) end it "fails if the scope encompasses more records than on the right hand side" do MockableModel.create expect(MockableModel.scoped).not_to match_array(models.reverse) end end it "fails if the scope encompasses fewer records than on the right hand side" do expect(MockableModel.limit(models.length - 1)).not_to match_array(models.reverse) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rspec-rails-2.99.0.beta2 | spec/rspec/rails/matchers/relation_match_array_spec.rb |