Re: New here: coverage reports, activerecord testing.

Luís Ferreira
Sun, 25 Nov 2012 11:52:08 -0000

Have you tried rake db:test:load?

On Nov 25, 2012, at 1:32 AM, Jacob Straszynski wrote:

> Hi. New potential contributor here.
>
> I''m trying to create the test case for:
https://github.com/rails/rails/issues/8195
> I created a file inside of test/cases/cache_key.rb and am executing it with
ruby -Itest test/cases/cache_key.rb - getting an error:
>
> ActiveRecord::StatementInvalid: Could not find table
''parents''
>
> My cache_test looks like:
>
> require "cases/helper"
>
> class Parent < ActiveRecord::Base
>   has_one :child
> end
>
> class Child < ActiveRecord::Base
>   belongs_to :parent, :touch => true
> end
>
> class TimestampTest < ActiveRecord::TestCase
>   def setup
>     @parent = Parent.create
>     Child.create(:parent => @parent)
>   end
>
>   def test_cache_key_changes_when_child_touched
>     key = @parent.cache_key
>     @parent.child.touch
>     @parent.reload
>     assert_not_equal key, @parent.cache_key
>   end
> end
>
> I was under the impression that the database tables are created
automatically when I run the test with rake test sqlite3
>
> Second question: does the team use anything for generating code coverage
reports? Trying to get simplecov set up for the framework to get an idea of
places where additional test cases could be written. I have some other research
ideas there like branch vs. statement coverage.
>
> Cheers.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
> To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-core/-/w9m1BdhJ-Y8J.
> To post to this group, send email to rubyonrails-core@googlegroups.com.
> To unsubscribe from this group, send email to
rubyonrails-core+unsubscribe@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en.

Cumprimentos,
Luís Ferreira



--
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-core@googlegroups.com.
To unsubscribe from this group, send email to
rubyonrails-core+unsubscribe@googlegroups.com.
For more options, visit this group at