Setting a breakpoint in a Rails 3 block (3.0.3)

I posted this in other places, but did not answer. Attempts to make Worka work inside Test / Unit in Rails 3.0.3 (1.9.2). When I try to run the test (copied below), I get this error:

test / unit / practice_member_test.rb: 4: in <class:PracticeMemberTest>': undefined methodcontext 'for PracticeMemberTest: Class (NoMethodError)

Please note that I have another Rails 3 project with Rspec, including Shoulda, and it works fine through Rspec. In a failed project, I tried to put β€œrequirea” in the test assistant to no avail, but when I run the debugger and type β€œPaste”, the object is found, so the library loads.

Here is my test:

test_helper required

class PracticeMemberTest <Test :: Unit :: TestCase context "practice participant" do
  should "count the number of participants in the global practice, not including the demo practice" 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

I must be ignoring something, as I have not seen anyone with the same problem.

+3
source share
1 answer

You tried to add the following to the config / environment.rb file:

  Rails::Initializer.run do |config|
    config.gem "shoulda", :lib => "shoulda"
  end

Then

 $ rake gems:install
 $ rake gems:unpack

As indicated in the documentation ?

0
source

Source: https://habr.com/ru/post/1780348/


All Articles