Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Find Mongoid associations #12

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
Contributor

ches commented Jan 24, 2011

As noted in the extended commit message, there was previously asymmetry between creating and finding models when using Mongoid:

Given a Post model that belongs to a User, a Given step like this would work:

Given the following posts exist:
  | title | user        |
  | foo   | user: "bob" |

but a similar Then step would not:

Then the following posts should exist:
  | title | user        |
  | foo   | user: "bob" |

The functionality of loading associations in convert_models_to_attributes doesn't really seem to be covered at all in the 0.4.x specs -- sorry for copping out and not adding some to cover it! It seems like something that would be best handled for various adapters with integration tests, and upon thinking this I saw your 0.5-unstable branch where it looks like Cucumber steps may be in the works for just this sort of thing. If I have a chance I'll have a further look at that branch, and take a stab at verifying this if it's not covered already.

Support Mongoid associations in find_model/s
Given a Post model that belongs to a User, there was previously
asymmetry in that a Given step like this would work:

  Given the following posts exist:
    | title | user        |
    | foo   | user: "bob" |

but a similar Then step would not:

  Then the following posts should exist:
    | title | user        |
    | foo   | user: "bob" |
Collaborator

chewi commented Nov 21, 2014

I can't test this but the change makes sense. Merged with a slight adjustment to avoid the additional stubbing.

@chewi chewi closed this Nov 21, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment