Sha256: 59fd90e6305df6417b6577346f03f4636f60d766501e031267a0d43375d77405

Contents?: true

Size: 686 Bytes

Versions: 2

Compression:

Stored size: 686 Bytes

Contents

require 'spec_helper'

class CollectionOwner < ActiveRecord::Base
  connection.execute <<-SQL
    CREATE TABLE collection_owners (
      id integer PRIMARY KEY AUTOINCREMENT
    )
SQL
  has_many :associated_items do
    def has_some_quality?; true end
  end
end

class AssociatedItem < ActiveRecord::Base
  connection.execute <<-SQL
    CREATE TABLE associated_items (
      id integer PRIMARY KEY AUTOINCREMENT,
      collection_owner_id integer
    )
SQL
  belongs_to :collection_owner
end

describe "should have_xxx" do
  it "works with ActiveRecord::Associations::CollectionProxy" do
    owner = CollectionOwner.new
    expect(owner.associated_items).to have_some_quality
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspec-rails-3.0.0.beta2 spec/rspec/rails/matchers/has_spec.rb
rspec-rails-2.99.0.beta2 spec/rspec/rails/matchers/has_spec.rb