A
A
Alexander Grishin2015-11-09 21:26:37
Software testing
Alexander Grishin, 2015-11-09 21:26:37

What does a line of code mean?

What does a line of code from the RoR book mean?
If so, then the test passes without error:

assert_equal ["must be greater than or equal to 0.01"]

And if you change at least one letter, then the test fails:
assert_equal ["must be greater than or equal too 0.01"]

Test result:
[email protected] ~/Dev/depot $ rake test
Run options: --seed 2627
# Running:
..........F.........
Finished in 0.556599s, 35.9325 runs/s, 88.0347 assertions/s.
  1) Failure:
ProductTest#test_Цена_продукта_должна_быть_правильной [/home/beerdy/Dev/depot/test/models/product_test.rb:25]:
--- expected
+++ actual
@@ -1 +1 @@
-["must be greater than or equal too 0.01"]
+["must be greater than or equal to 0.01"]
20 runs, 49 assertions, 1 failures, 0 errors, 0 skips

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
JS, 2015-11-10
@beerdy

assert_equal ["must be greater than or equal to 0.01"]
checks that an error is displayed that says must be greater than or equal to 0.01

A
Alexander Grishin, 2015-11-10
@beerdy

I understand that this validation, in case of an error, raises an exception in the form of a string:
And this assert_equal method, as I understand it, just compares two strings? It turns out that it is simply used for aesthetic design in tests (or whatever it is called)?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question