diff --git a/Sources/Rubicon/Generator/EnumStubGenerator.swift b/Sources/Rubicon/Generator/EnumStubGenerator.swift index c410082..e99c076 100644 --- a/Sources/Rubicon/Generator/EnumStubGenerator.swift +++ b/Sources/Rubicon/Generator/EnumStubGenerator.swift @@ -6,18 +6,15 @@ final class EnumStubGeneratorImpl: EnumStubGenerator { private let extensionGenerator: ExtensionGenerator private let functionGenerator: FunctionGenerator private let indentationGenerator: IndentationGenerator - private let defaultValueGenerator: DefaultValueGenerator init( extensionGenerator: ExtensionGenerator, functionGenerator: FunctionGenerator, - indentationGenerator: IndentationGenerator, - defaultValueGenerator: DefaultValueGenerator + indentationGenerator: IndentationGenerator ) { self.extensionGenerator = extensionGenerator self.functionGenerator = functionGenerator self.indentationGenerator = indentationGenerator - self.defaultValueGenerator = defaultValueGenerator } func generate(from enumType: EnumDeclaration, functionName: String) -> String { @@ -51,16 +48,4 @@ final class EnumStubGeneratorImpl: EnumStubGenerator { "return \(firstCase)" ] } - - private func makeAssigment(of variable: VarDeclaration, isLast: Bool) -> String { - return "\(variable.identifier): \(variable.identifier)\(isLast ? "" : ",")" - } - - private func makeArgument(from varDeclaration: VarDeclaration) -> ArgumentDeclaration { - ArgumentDeclaration( - name: varDeclaration.identifier, - type: varDeclaration.type, - defaultValue: defaultValueGenerator.makeDefaultValue(for: varDeclaration) - ) - } } diff --git a/Sources/Rubicon/Integration/Rubicon.swift b/Sources/Rubicon/Integration/Rubicon.swift index 7c9473b..603d860 100644 --- a/Sources/Rubicon/Integration/Rubicon.swift +++ b/Sources/Rubicon/Integration/Rubicon.swift @@ -55,6 +55,22 @@ public struct StructStubConfiguration { } } +public struct EnumStubConfiguration { + public let accessLevel: AccessLevel + public let indentStep: String + public let functionName: String + + public init( + accessLevel: AccessLevel, + indentStep: String, + functionName: String + ) { + self.accessLevel = accessLevel + self.indentStep = indentStep + self.functionName = functionName + } +} + public final class Rubicon { public init() {} @@ -284,7 +300,7 @@ public final class Rubicon { return EnumParserImpl() } - public func makeEnumGenerator(for configuration: StructStubConfiguration) -> EnumStubGenerator { + public func makeEnumGenerator(for configuration: EnumStubConfiguration) -> EnumStubGenerator { let dependencies = makeDependencies( for: configuration.accessLevel, indentStep: configuration.indentStep @@ -300,11 +316,7 @@ public final class Rubicon { argumentGenerator: dependencies.argumentGenerator, indentationGenerator: dependencies.indentationGenerator ), - indentationGenerator: dependencies.indentationGenerator, - defaultValueGenerator: DefaultValueGeneratorImpl( - unknownDefaultType: configuration.defaultValue, - customDefaultTypes: configuration.customDefaultValues - ) + indentationGenerator: dependencies.indentationGenerator ) } } diff --git a/Tests/RubiconTests/Generator/EnumStubGeneratorTests.swift b/Tests/RubiconTests/Generator/EnumStubGeneratorTests.swift index 9dde2c2..e355da2 100644 --- a/Tests/RubiconTests/Generator/EnumStubGeneratorTests.swift +++ b/Tests/RubiconTests/Generator/EnumStubGeneratorTests.swift @@ -5,7 +5,6 @@ final class EnumStubGeneratorTests: XCTestCase { private var extensionGeneratorSpy: ExtensionGeneratorSpy! private var functionGeneratorSpy: FunctionGeneratorSpy! private var indentationGeneratorStub: IndentationGeneratorStub! - private var defaultValueGeneratorSpy: DefaultValueGeneratorSpy! private var sut: EnumStubGeneratorImpl! override func setUp() { @@ -13,12 +12,10 @@ final class EnumStubGeneratorTests: XCTestCase { extensionGeneratorSpy = ExtensionGeneratorSpy(makeReturn: ["extension"]) functionGeneratorSpy = FunctionGeneratorSpy(makeCodeReturn: ["function"]) indentationGeneratorStub = IndentationGeneratorStub() - defaultValueGeneratorSpy = DefaultValueGeneratorSpy(makeDefaultValueReturn: "default") sut = EnumStubGeneratorImpl( extensionGenerator: extensionGeneratorSpy, functionGenerator: functionGeneratorSpy, - indentationGenerator: IndentationGeneratorStub(), - defaultValueGenerator: defaultValueGeneratorSpy + indentationGenerator: IndentationGeneratorStub() ) }