Skip to content

Instantly share code, notes, and snippets.

@danmcclain
Created November 4, 2011 15:16
Show Gist options
  • Select an option

  • Save danmcclain/1339556 to your computer and use it in GitHub Desktop.

Select an option

Save danmcclain/1339556 to your computer and use it in GitHub Desktop.
Then /^I should see the assigned to my students$/ do
@user.students.map(&:notes).flatten.each do |note|
have_note_content(note, :should)
end
end
# @user.students.map(&:notes).flatten is equivalent to
students = @user.students
note_arrays = students.map { |student| student.notes } #shorthand: .map(&:notes)
notes = note_arrays.flatten
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment