1

I am trying to figure out why my rspec test fails when matching a string value. Other tests doing similar matching are successful.

I get the following failed result:

1) Class #method should get the string

Failure/Error: class.method.should == "LD 513"
 expected: "LD 513"
 got: "LD 513" (using ==)

If I output the result to the screen, I see this which shows the value of the variable and the variable type so my assumption is that everything should pass.

variable: "LD 513" -- String

Any idea why this test fails?

Thanks.

1 Answer 1

2

I found the problem. It was a character encoding issue. Essentially a hidden character was in between the letters and numbers. Once I normalized the string, the test passed.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.