On Tue, Dec 14, 2010 at 6:17 PM, David Kahn <[email protected]>wrote:

> Curious if anyone has Shoulda working with test/unit in Rails 3. I tried it
> this morning and am getting:
>
> test/unit/practice_member_test.rb:4:in `<class:PracticeMemberTest>':
> undefined method `context' for PracticeMemberTest:Class (NoMethodError)
>
> Now, I have a Rails 3 project with Rspec including Shoulda also and it
> works fine. I tried placing  "require 'shoulda'" in test helper to no avail,
> but when I run the debugger and type Shoulda, the object is found.
>
>
> It it helps, here is my test:
>
> require 'test_helper'
>
> class PracticeMemberTest < Test::Unit::TestCase
>   context "practice member" do
>     should "get global practice member count not including Demo Practice"
> do
>       assert_equal PracticeMember.practice_members_global_count, 0
>
>       practice = Factory.create(:practice_one)
>
>       practice_member = Factory.create(:practice_member)
>       practice_member.practice_id = practice.id
>       practice_member.save
>       practice_member = Factory.create(:practice_member)
>       practice_member.practice_id = practice.id
>       practice_member.save
>
>       assert_equal PracticeMember.practice_members_global_count, 2
>     end
>   end
> end
>
>
the whole context syntax is been deprecated in favor of a pure rspec like
syntax.

http://robots.thoughtbot.com/post/701863189/shoulda-rails3-and-beyond

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to