Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions exercises/practice/meetup/.meta/test_template.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require 'minitest/autorun'
require_relative 'meetup'

class MeetupTest < Minitest::Test
<% json["cases"].each do |cases| %>
def test_<%= underscore(cases["description"]) %>
<%= skip? %>
meetup = Meetup.new(<%= cases["input"]["month"] %>, <%= cases["input"]["year"] %>).day(:<%= cases["input"]["dayofweek"].downcase %>, :<%= cases["input"]["week"] %>)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conceptually, and as a pattern, the tests are assert expected, actual and we can use these names. If we are careful with this, a high percentage of template portions will follow this pattern, the only difference being what is referenced by actual as to what is called, while the expected is always what we expect.

assert_equal Date.parse('<%= cases["expected"] %>'), meetup
end
<% end %>
end
Loading