diff --git a/test/grouped_scope/has_many_association_test.rb b/test/grouped_scope/has_many_association_test.rb index c9c72c8..1d6864a 100644 --- a/test/grouped_scope/has_many_association_test.rb +++ b/test/grouped_scope/has_many_association_test.rb @@ -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 diff --git a/test/grouped_scope/self_grouping_test.rb b/test/grouped_scope/self_grouping_test.rb index b86d8d5..95bd15b 100644 --- a/test/grouped_scope/self_grouping_test.rb +++ b/test/grouped_scope/self_grouping_test.rb @@ -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