Implement Java naming

This commit is contained in:
Michael Miller 2019-03-23 16:27:51 -06:00
parent 93368503e6
commit 3fbe6a2760
2 changed files with 13 additions and 3 deletions

View file

@ -28,7 +28,12 @@ module Spectator::Formatting
# Java-ified class name created from the spec.
private def classname
"TODO"
path = result.example.source.path
file = File.basename(path)
ext = File.extname(file)
name = file[0...-(ext.size)]
dir = path[0...-(file.size + 1)]
{dir.gsub('/', '.').underscore, name.camelcase}.join('.')
end
end
end

View file

@ -32,12 +32,17 @@ module Spectator::Formatting
# Java-ified name of the test suite.
private def name
"TODO"
file = File.basename(@path)
ext = File.extname(file)
name = file[0...-(ext.size)]
name.camelcase
end
# Java-ified package (path) of the test suite.
private def package
"TODO"
file = File.basename(@path)
dir = @path[0...-(file.size + 1)]
dir.gsub('/', '.').underscore
end
# Selector for creating a JUnit test case based on a result.