Sha256: b28560f77eae6eaf3497872992ce2ca6b04d702070a600302555df79c174ecd6
Contents?: true
Size: 1.84 KB
Versions: 27
Compression:
Stored size: 1.84 KB
Contents
require 'spec_helper' require 'scorpion/rails' describe Scorpion::Rails::ActiveRecord::Relation, type: :model do include Scorpion::Rspec::Helper let( :criteria ) { Todo.with_scorpion( scorpion ) } it "shares scorpion with fetched records" do Todo.create! name: "Be awesome" expect( criteria.first.scorpion ).to eq scorpion end it "shares scorpion with chained relations" do expect( criteria.where( name: "" ).scorpion ).to be scorpion end it "shares scorpion with new records" do expect( criteria.new.scorpion ).to be scorpion expect( criteria.build.scorpion ).to be scorpion end it "shares scorpion with new records builder block" do criteria.new do |todo| expect( todo.scorpion ).to be scorpion end end it "shares scorpion with created records" do expect( criteria.create.scorpion ).to be scorpion end it "shares scorpion with created records builder block" do criteria.create do |todo| expect( todo.scorpion ).to be scorpion end end it "shares scorpion with created! records" do expect( criteria.create!.scorpion ).to be scorpion end it "shares scorpion with created! records builder block" do criteria.create! do |todo| expect( todo.scorpion ).to be scorpion end end context "find methods" do let!( :todo ){ Todo.create! name: "Bill" } it "shares scorpion with found records" do expect( criteria.find( todo.id ).scorpion ).to be scorpion end it "shares scorpion with find_by records" do expect( criteria.find_by( name: "Bill" ).scorpion ).to be scorpion end it "shares scorpion with first record" do expect( criteria.first.scorpion ).to be scorpion end it "shares scorpion with enumerated records" do criteria.each do |todo| expect( todo.scorpion ).to be scorpion end end end end
Version data entries
27 entries across 27 versions & 1 rubygems