Skip to content

Commit

Permalink
Test: fetch names of ensure_ methods from DSL class
Browse files Browse the repository at this point in the history
To avoid this list going out of sync.
  • Loading branch information
olleolleolle committed Nov 24, 2023
1 parent 12740d3 commit cf73c7c
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions test/install_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ def test_creates_initializer_file

assert_file("config/initializers/data_checks.rb") do |content|
assert_includes content, "DataChecks.configure do"
%w[
:ensure_no
:ensure_any
:ensure_more
:ensure_less
:ensure_equal
].each do |dsl_method_name|
expected_dsl_methods = DataChecks::Config.new
.public_methods
.select { |dsl_method_name| dsl_method_name.to_s.start_with?("ensure_") }
.map(&:to_s)

expected_dsl_methods.each do |dsl_method_name|
assert_includes content, dsl_method_name
end
end
Expand Down

0 comments on commit cf73c7c

Please sign in to comment.