Ruby Testing: Block vs. Method

Since I wrote test suites for a Rails application, I noticed that there are two different ways to create tests: a block testand a regular method:

test "the truth" do
  assert true
end

against.

def test_for_something_else
  assert true
end

Is there a difference between the two test structures? When should I use one over the other?

Edit: Upon further verification, tests written as methods are counted in rake:stats, but those written with syntax testare not. There is one difference ...

+3
source share
3 answers

, - , , RSpec, To X.... .

  • .
+4

, . , , [1]. - , / .

[1] "add two interleaving timers that trigger in the opposite order" vs. test_addTwoInterleavingTimersThatTriggerInTheOppositeOrder(...)

+1

/, , Vim Ctags TagList. , :TlistToggle. , .

0

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


All Articles