The "test" method copied below complains when another test of the same
name if found in another test file.

The following doesn't work...

test/integration/users_test.rb
test "this is a test" do
 ...
end

test/integration/forums_test.rb
test "this is a test" do
 ...
end

but this does work...

test/integration/users_test.rb
def this_is_a_test
 ...
end

test/integration/forums_test.rb
def this_is_a_test
 ...
end

What's the purpose for "test" working this way?

 # File vendor/rails/activesupport/lib/active_support/testing/declarative.rb,
line 7
 7:       def test(name, &block)
 8:         test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym
 9:         defined = instance_method(test_name) rescue false
10:         raise "#{test_name} is already defined in #{self}" if defined
11:         if block_given?
12:           define_method(test_name, &block)
13:         else
14:           define_method(test_name) do
15:             flunk "No implementation provided for #{name}"
16:           end
17:         end
18:       end

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to rubyonrails-c...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-core+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.


Reply via email to