Hi! I''ve discovered that when I reopen classes to return another value, everything works fine when launching the test manually but when I use rake test, the value set reopening the class impacts other tests. Do you know why? PS: yeah I know I can use mocha ;) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/JdnKnJaOc9oJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Aug 26, 10:57 am, Michel Pigassou <dag...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi! > > I''ve discovered that when I reopen classes to return another value, > everything works fine when launching the test manually but when I use rake > test, the value set reopening the class impacts other tests. >Tests should leave the environment unchanged. That''s why (for example) transactions are used so that objects created in one test aren''t there when the next test runs. Your test framework doesn''t know how to undo whatever you did when you reopened the class, so the change persists. If you absolutely have to do it this way, you''ll need to undo the change once the test that needs it is complete. Fred> Do you know why? > > PS: yeah I know I can use mocha ;)-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I hear you Frederick. But I forgot one detail: my problem is that a class reopen in a test file impacts tests in another test file. I thought rake would reload every class between each test file. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/ug3yU8zUT9cJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Aug 26, 2:32 pm, Michel Pigassou <dag...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I hear you Frederick. But I forgot one detail: my problem is that a class > reopen in a test file impacts tests in another test file. > I thought rake would reload every class between each test file.As you have discovered, it doesn''t (would probably be prohibitively slow) 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.