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

'where' method is modifying the receiver #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions spec/relation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class EmailAccount
a_task.assignees.all.should.be.empty
end



it "supports creating related objects directly on parents" do
a_task = Task.create(:name => 'Walk the Dog')
a_task.assignees.create(:assignee_name => 'bob')
Expand Down Expand Up @@ -109,6 +111,16 @@ class EmailAccount
Task.find(3).assignees.count.should == assignee_count + 1
end

it "should not change the count of assignees" do
task = Task.first
1.upto(10){ |i| task.assignees.create(:assignee_name => "Assignee #{i}") }
assignees = task.assignees
puts assignees.inspect
count = assignees.count
assignees.where(:assignee_name).eq("Assignee 1")
assignees.count.should == count
end

end

it "supports creating blank (empty) scratchpad associated objects" do
Expand Down