Skip to content

Commit

Permalink
Merge pull request #611 from Insti/Example_file_location_bugfix
Browse files Browse the repository at this point in the history
tests: Check in the correct location for the example file.
  • Loading branch information
hilary authored May 7, 2017
2 parents 8679661 + ae435ea commit 98ea112
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/tasks/exercise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def directory
end

def example_file
File.exist?(example_filename) ? example_filename : legacy_example_filename
File.exist?(File.join(directory, example_filename)) ? example_filename : legacy_example_filename
end

def testable_example_file
Expand Down
6 changes: 4 additions & 2 deletions test/tasks/exercise_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ def test_directory
end

def test_example_file
File.stub(:exist?, true) do
assert_equal '.meta/solutions/name.rb', Exercise.new('name').example_file
mock_exist = Minitest::Mock.new
mock_exist.expect(:call, true, ['exercises/alpha/./.meta/solutions/alpha.rb'])
File.stub(:exist?, mock_exist) do
assert_equal '.meta/solutions/alpha.rb', Exercise.new('alpha').example_file
end
end

Expand Down

0 comments on commit 98ea112

Please sign in to comment.