Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 3 additions & 1 deletion lib/generator/command_line/generator_optparser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ def validate_exercise

def validate_cases
return true if available_generators.include?(options[:slug])
$stderr.puts "A generator does not currently exist for #{options[:slug]}!"
warning = "A generator does not currently exist for #{options[:slug]}!"
expected_location = "Expecting it to be at: #{Files::GeneratorCases.source_filepath(@paths.track, options[:slug])}"
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.

Good catch

$stderr.puts [warning, expected_location].join("\n")
false
end
end
Expand Down
13 changes: 11 additions & 2 deletions test/generator/command_line/generator_optparser_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,18 @@ def test_validate_slug
end

def test_validate_missing_generator
args = %w(nonexistent)
args = %w(non-existent)
Files::GeneratorCases.stub :available, [] do
assert_output(nil, /A generator does not currently exist fo/) do
assert_output(nil, /A generator does not currently exist for non-existent/) do
refute GeneratorOptparser.new(args, FixturePaths).options_valid?
end
end
end

def test_missing_generator_tells_you_where_it_looked
args = %w(non-existent)
Files::GeneratorCases.stub :available, [] do
assert_output(nil, %r{exercises/non-existent/\.meta/generator/non_existent_case\.rb}) do
refute GeneratorOptparser.new(args, FixturePaths).options_valid?
end
end
Expand Down