0
Failure/Error: @group.attributes.keys.should include (Group.first.attributes.keys)     
   expected 

["id", "duration", "frequency", "period", "group_size", "location", "service", "area_of_need", "created_at", "updated_at", "therapist_id", "start_date", "end_date", "student_id", "adhoc"] 
to include  
["id", "duration", "frequency", "period", "group_size", "location", "service", "area_of_need", "created_at", "updated_at", "therapist_id", "start_date", "end_date", "student_id", "adhoc"]

Test:

@group.attributes.keys.should include (Group.first.attributes.keys) 
0

2 Answers 2

2

Because a.should includes(b) asserts that a.include? b is true andinclude? checks to see if an array's elements includes an object, not whether one array equals another

[1].include? [1]
=> false

[1].include? 1
=> true

[[1]].include? [1]
=> true
Sign up to request clarification or add additional context in comments.

Comments

1

Te answer was that the hash comparison fails on Ubuntu but works on Mac's.

My workaround is:

i=0
  while i < @group.attributes.count
  assert_equal @group.attributes[i], Group.first.attributes[i]
  i+= 1
end

# Comparing field by field as ruby hash comparison isn't working right - 
# but only on Ubuntu!

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.