I'm using this:
4.times { |i| assert_not_equal("content#{i + 2}".constantize, object.first_content) }
and i have previously declared local variables
content1
content2
content3
content4
content5
the error I get
NameError: wrong constant name content2
Whot does this error mean? I'm pretty sure that I want content2 =\
You have to call ruby constants with a big letter:
Content2
instead of content2
.
A constant name starts with an uppercase letter followed by name characters. Class names and module names are constants, and follow the constant naming conventions. By convention, constant variables are normally spelled using uppercase letters and underscores throughout.
Link
It should be noted though that there is no such thing as constant variables, but constant values.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With