Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bug in ActiveFedora::FinderMethods#load_from_fedora #434

Merged
merged 1 commit into from
Jun 19, 2014
Merged

Fixed bug in ActiveFedora::FinderMethods#load_from_fedora #434

merged 1 commit into from
Jun 19, 2014

Conversation

dchandekstark
Copy link
Member

so that it casts when klass is ActiveFedora::Base and `cast' argument is nil, as intended.
Fixes #431 since by default it calls load_from_fedora(pid, nil) on each hit.

@jcoyne
Copy link
Member

jcoyne commented Jun 19, 2014

I think the test in this case is particularly unclear and highly dependent on the existing code structure. I'd like to see a test like:

  before { Foo.create('test:123')  }

  expect(ActiveFedora::Base.send(:load_from_fedora, "test:123", nil)).to be_kind_of Foo

…casts

when klass is ActiveFedora::Base and `cast' argument is nil, as intended.
Fixes #431 since by default it calls load_from_fedora(pid, nil) on each hit.
it "should cast when klass == ActiveFedora::Base and cast argument is nil" do
expect(relation.send(:load_from_fedora, "test:123", nil)).to be_a SpecModel::Basic
end
end
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jcoyne Is the above better?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@jcoyne
Copy link
Member

jcoyne commented Jun 19, 2014

👍

jcoyne added a commit that referenced this pull request Jun 19, 2014
Fixed bug in ActiveFedora::FinderMethods#load_from_fedora
@jcoyne jcoyne merged commit 4259edf into samvera:master Jun 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

find_each doesn't cast AF::Base by default
2 participants