On Mar 25, 3:07 am, "sol.manager" <sol.mana...@gmail.com> wrote:

> So, two questions. When I compare the two I see differences in the
> structure. Our current 2.1.0 site test had the following:
> require File.dirname(__FILE__) + '/../test_helper'
>
> class JobPostTest < Test::Unit::TestCase
>   fixtures :job_posts
>
>   # Replace this with your real tests.
>   def test_truth
>     assert true
>   end
> end
>
> So, I go over the freshly minted, empty 2.2.2 app and look at the test
> created when I scaffolded and saw:
> require 'test_helper'
>
> class JobPostTest < ActiveSupport::TestCase
>   # Replace this with your real tests.
>   test "the truth" do
>     assert true
>   end
> end
>
> Is some of this because the default test syntax has changed? Is there
> a way to re-create the unit tests in my older app? Basically, tell
> Rails to overwrite the older unit tests and create new ones that match
> the tables in the schema.rb? I understand the default tests don't do
> much, but I would like to start with a clean slate since I don't think
> our sites tests have much in them anyway.

Rails can't guess what your models should do, so it can't possibly
rewrite your tests. It would be possible to write something that would
rewrite

require File.dirname(__FILE__) + '/../test_helper'

to

require 'test_helper'

but you could just use search & replace in your editor.

test "foo" do
end

is just a style thing. Behind the scenes it will generate a test_foo
method, and you can continue to just write def test_foo (about the
only different is that test 'foo' will raise an error if there is
already a test with that name

Fred

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

Reply via email to