BuilderFactory getter on Environment

This commit is contained in:
Mitchell Hashimoto 2013-04-20 19:31:42 -06:00
parent 298c0ffa17
commit 05e254a2ff
2 changed files with 14 additions and 0 deletions

View File

@ -80,6 +80,11 @@ func NewEnvironment(config *EnvironmentConfig) (env *Environment, err error) {
return
}
// Returns the BuilderFactory associated with this Environment.
func (e *Environment) BuilderFactory() BuilderFactory {
return e.builderFactory
}
// Executes a command as if it was typed on the command-line interface.
// The return value is the exit code of the command.
func (e *Environment) Cli(args []string) int {

View File

@ -60,6 +60,15 @@ func TestNewEnvironment_NoConfig(t *testing.T) {
assert.NotNil(err, "should be an error")
}
func TestEnvironment_GetBuilderFactory(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true)
config := DefaultEnvironmentConfig()
env, _ := NewEnvironment(config)
assert.Equal(env.BuilderFactory(), config.BuilderFactory, "should match factories")
}
func TestEnvironment_Cli_CallsRun(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true)