v3.1.0 -
Show latest stable
-
1 note
- Superclass:
Object
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0 (0)
- 3.0.9 (-38)
- 3.1.0 (0)
- 3.2.1 (0)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2 (0)
- 4.1.8 (0)
- 4.2.1 (0)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1 (13)
- 5.1.7 (0)
- 5.2.3 (0)
- 6.0.0 (0)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2 (0)
- 7.1.3.4 (0)
- What's this?
Active Record Relation
Constants
JoinOperation = Struct.new(:relation, :join_class, :on)
ASSOCIATION_METHODS = [:includes, :eager_load, :preload]
MULTI_VALUE_METHODS = [:select, :group, :order, :joins, :where, :having, :bind]
SINGLE_VALUE_METHODS = [:limit, :offset, :lock, :readonly, :from, :reorder, :reverse_order]
Attributes
[RW] | default_scoped | |
[RW] | extensions | |
[R] | table | |
[R] | klass | |
[R] | loaded | |
[R] | loaded? | |
[RW] | default_scoped? |
Register or
log in
to add new notes.
michalhantl -
August 26, 2019
![Default_avatar_30](https://www.gravatar.com/avatar/c2a5bc0633a2eef9274744bd273063a4?default=http://apidock.com/images/default_avatar_30.png&size=30)
0 thanks
expect_any_instance_of(ActiveRecord::Relation).to receive(:create_with) and others do not work
If you’re doing
expect_any_instance_of(ActiveRecord::Relation).to receive(:create_with)
and it does not work, try:
expect_any_instance_of(ActiveRecord::Associations::CollectionProxy).to receive(:create_with) { |proxy, attributes| expect(proxy.klass).to eq(RecordClass) expect(attributes[:....]).to eq(...) double('find_or_create_by!' => Proc.new {}) }
or when testing “find_or_create_by”
expect_any_instance_of(ActiveRecord::Associations::CollectionProxy).to receive(:find_or_create_by) { |proxy, attributes| expect(proxy.klass).to eq(RecordClass) expect(attributes[:....]).to eq(...) }