Skip to content

Commit

Permalink
lint issues solved
Browse files Browse the repository at this point in the history
  • Loading branch information
rogersole committed Jul 16, 2018
1 parent 1544ca3 commit 2091756
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
30 changes: 15 additions & 15 deletions test/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,63 +10,63 @@ func TestFindExistingPriceByDay(t *testing.T) {
given, when, then := stages.ConfigTest(t)

given.
A_valid_configuration_correctly_loaded()
AValidConfigurationCorrectlyLoaded()

when.
An_existing_price_is_requested()
AnExistingPriceIsRequested()

then.
Value_is_found()
ValueIsFound()
}

func TestFindNonExistingPriceByDay(t *testing.T) {
given, when, then := stages.ConfigTest(t)

given.
A_valid_configuration_correctly_loaded()
AValidConfigurationCorrectlyLoaded()

when.
A_non_existing_price_is_requested()
ANonExistingPriceIsRequested()

then.
Value_is_not_found()
ValueIsNotFound()
}

func TestFindExistingRotationUserInfoById(t *testing.T) {
given, when, then := stages.ConfigTest(t)

given.
A_valid_configuration_correctly_loaded()
AValidConfigurationCorrectlyLoaded()

when.
An_existing_rotation_info_is_requested()
AnExistingRotationInfoIsRequested()

then.
Value_is_found()
ValueIsFound()
}

func TestFindNonExistingRotationUserInfoById(t *testing.T) {
given, when, then := stages.ConfigTest(t)

given.
A_valid_configuration_correctly_loaded()
AValidConfigurationCorrectlyLoaded()

when.
A_non_existing_rotation_info_is_requested()
ANonExistingRotationInfoIsRequested()

then.
Value_is_not_found()
ValueIsNotFound()
}

func TestConfigurationMalformed(t *testing.T) {
given, when, then := stages.ConfigTest(t)

given.
A_malformed_configuration()
AMalformedConfiguration()

when.
It_is_loaded()
ItIsLoaded()

then.
Config_error_is_created()
ConfigErrorIsCreated()
}
24 changes: 12 additions & 12 deletions test/stages/config_stage.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (s *ConfigStage) And() *ConfigStage {
return s
}

func (s *ConfigStage) A_valid_configuration() *ConfigStage {
func (s *ConfigStage) AValidConfiguration() *ConfigStage {
s.configRaw = []byte(`
pdAuthToken: abcdefghijklm
rotationStartHour: 08:00:00
Expand All @@ -61,7 +61,7 @@ schedulesToIgnore:
return s
}

func (s *ConfigStage) A_malformed_configuration() *ConfigStage {
func (s *ConfigStage) AMalformedConfiguration() *ConfigStage {
s.configRaw = []byte(`
pdAuthToken: abcdefghijklm
rotationStartHour: 08:00:00
Expand All @@ -84,13 +84,13 @@ pdAuthToken: abcdefghijklm
return s
}

func (s *ConfigStage) A_valid_configuration_correctly_loaded() *ConfigStage {
s.A_valid_configuration().And().It_is_loaded()
func (s *ConfigStage) AValidConfigurationCorrectlyLoaded() *ConfigStage {
s.AValidConfiguration().And().ItIsLoaded()
assert.Nil(s.t, s.configError)
return s
}

func (s *ConfigStage) It_is_loaded() *ConfigStage {
func (s *ConfigStage) ItIsLoaded() *ConfigStage {
viper.SetConfigType("yaml")
s.configError = viper.ReadConfig(bytes.NewBuffer(s.configRaw))
if s.configError == nil {
Expand All @@ -100,38 +100,38 @@ func (s *ConfigStage) It_is_loaded() *ConfigStage {
return s
}

func (s *ConfigStage) An_existing_price_is_requested() *ConfigStage {
func (s *ConfigStage) AnExistingPriceIsRequested() *ConfigStage {
s.mapValue, s.mapError = s.config.FindPriceByDay("weekday")
return s
}

func (s *ConfigStage) A_non_existing_price_is_requested() *ConfigStage {
func (s *ConfigStage) ANonExistingPriceIsRequested() *ConfigStage {
s.mapValue, s.mapError = s.config.FindPriceByDay("wokday")
return s
}

func (s *ConfigStage) An_existing_rotation_info_is_requested() *ConfigStage {
func (s *ConfigStage) AnExistingRotationInfoIsRequested() *ConfigStage {
s.mapValue, s.mapError = s.config.FindRotationUserInfoByID("ABCDEF1")
return s
}

func (s *ConfigStage) A_non_existing_rotation_info_is_requested() *ConfigStage {
func (s *ConfigStage) ANonExistingRotationInfoIsRequested() *ConfigStage {
s.mapValue, s.mapError = s.config.FindRotationUserInfoByID("NONE")
return s
}

func (s *ConfigStage) Value_is_found() *ConfigStage {
func (s *ConfigStage) ValueIsFound() *ConfigStage {
assert.Nil(s.t, s.mapError)
assert.NotNil(s.t, s.mapValue)
return s
}

func (s *ConfigStage) Value_is_not_found() *ConfigStage {
func (s *ConfigStage) ValueIsNotFound() *ConfigStage {
assert.NotNil(s.t, s.mapError)
assert.Nil(s.t, s.mapValue)
return s
}
func (s *ConfigStage) Config_error_is_created() *ConfigStage {
func (s *ConfigStage) ConfigErrorIsCreated() *ConfigStage {
assert.NotNil(s.t, s.configError)
return s
}

0 comments on commit 2091756

Please sign in to comment.