Sha256: 918cf93d5f729268387ef0a7ee33d94cb02ac8cf8ae50c34249e18fdba4b0195

Contents?: true

Size: 1.02 KB

Versions: 9

Compression:

Stored size: 1.02 KB

Contents

require "spec_helper"

describe Scorpion::Rails::ActiveRecord::Model, type: :model do
  include Scorpion::Rspec::Helper

  before( :each ) do
    author = Author.create! name: "Pitbull"
    Todo.create! name: "Be even more awesome", author: author
  end

  it "shares scorpion with associations" do
    author = Author.with_scorpion( scorpion ).first
    expect( author.todos.scorpion ).to be scorpion
  end

  it "shares scorpion with single associations" do
    todo = Todo.with_scorpion( scorpion ).first
    expect( todo.author.scorpion ).to be scorpion
  end

  it "shares scorpion with custom scope" do
    expect( Author.with_scorpion( scorpion ).named( "Pitbull" ).scorpion ).to be scorpion
  end

  it "shares scorpion with custom scope results" do
    expect( Author.with_scorpion( scorpion ).named( "Pitbull" ).first.scorpion ).to be scorpion
  end

  it "shares scorpion with custom scope extension results" do
    expect( Author.with_scorpion( scorpion ).named( "Pitbull" ).alphabetical.first.scorpion ).to be scorpion
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
scorpion-ioc-1.0.10 spec/lib/scorpion/rails/active_record/model_spec.rb
scorpion-ioc-1.0.8 spec/lib/scorpion/rails/active_record/model_spec.rb
scorpion-ioc-1.0.7 spec/lib/scorpion/rails/active_record/model_spec.rb
scorpion-ioc-1.0.6 spec/lib/scorpion/rails/active_record/model_spec.rb
scorpion-ioc-1.0.4 spec/lib/scorpion/rails/active_record/model_spec.rb
scorpion-ioc-1.0.3 spec/lib/scorpion/rails/active_record/model_spec.rb
scorpion-ioc-1.0.2 spec/lib/scorpion/rails/active_record/model_spec.rb
scorpion-ioc-1.0.1 spec/lib/scorpion/rails/active_record/model_spec.rb
scorpion-ioc-1.0.0 spec/lib/scorpion/rails/active_record/model_spec.rb