Skip to content

Commit

Permalink
Starting to move tests to correct place. HasManyAssociationTest vs. S…
Browse files Browse the repository at this point in the history
…elfGrouppingTest.
  • Loading branch information
metaskills committed Sep 23, 2008
1 parent 621b483 commit 8937532
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 34 deletions.
4 changes: 0 additions & 4 deletions test/grouped_scope/has_many_association_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ def setup

context 'for an Employee' do

setup do
@con = ActiveRecord::Base.connection
end

should 'simply work' do
@employee = Factory(:employee)
assert_instance_of Array, @employee.reports
Expand Down
67 changes: 37 additions & 30 deletions test/grouped_scope/self_grouping_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,51 @@ def setup
setup_environment
end


context 'Calling #group' do
context 'General behavior' do

context 'in general behavior' do

setup do
@employee = Factory(:employee)
end

should 'return an array' do
assert_instance_of Array, @employee.group
end

should 'respond true to grouped associations' do
assert @employee.group.respond_to?(:reports)
end

context 'for Array delegates' do
setup do
@employee = Factory(:employee)
end

should 'return an array' do
assert_instance_of Array, @employee.group
end

should 'respond true to grouped associations' do
assert @employee.group.respond_to?(:reports)
end

context 'for Array delegates' do

should 'respond to first/last' do
[:first,:last].each do |method|
assert @employee.group.respond_to?(method), "Should respond to #{method.inspect}"
end
should 'respond to first/last' do
[:first,:last].each do |method|
assert @employee.group.respond_to?(method), "Should respond to #{method.inspect}"
end

should 'respond to each' do
assert @employee.group.respond_to?(:each)
@employee.group.each do |employee|
# FIXME: Figure why this does not work.
# assert_instance_of Employee, employee
assert_equal Employee.name, employee.class.name
end
end

should 'respond to each' do
assert @employee.group.respond_to?(:each)
@employee.group.each do |employee|
# FIXME: Figure out why this does not work: assert_instance_of Employee, employee
assert_equal Employee.name, employee.class.name
end

end

end

end






context 'Calling #group' do





context 'with no group_id schema' do

should 'raise a GroupedScope::NoGroupIdError exception' do
Expand Down

0 comments on commit 8937532

Please sign in to comment.