Skip to content

Commit

Permalink
Merge pull request #113 from serradura/dev-4.2.1
Browse files Browse the repository at this point in the history
[4.2.1] Fix the inspect methods output
  • Loading branch information
serradura authored Oct 22, 2020
2 parents 968c44c + 2364b21 commit 4499cb5
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 24 deletions.
23 changes: 14 additions & 9 deletions .travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,41 @@
ruby_v=$(ruby -v)

ACTIVERECORD_VERSION='3.2' bundle update
ACTIVERECORD_VERSION='3.2' ENABLE_TRANSITIONS='false' bundle exec rake test
ACTIVERECORD_VERSION='3.2' ENABLE_TRANSITIONS='true' bundle exec rake test
ACTIVERECORD_VERSION='3.2' ENABLE_TRANSITIONS='false' bundle exec rake test

ACTIVERECORD_VERSION='4.0' bundle update
ACTIVERECORD_VERSION='4.0' bundle exec rake test
ACTIVERECORD_VERSION='4.0' ENABLE_TRANSITIONS='true' bundle exec rake test
ACTIVERECORD_VERSION='4.0' ENABLE_TRANSITIONS='false' bundle exec rake test

ACTIVERECORD_VERSION='4.1' bundle update
ACTIVERECORD_VERSION='4.1' bundle exec rake test
ACTIVERECORD_VERSION='4.1' ENABLE_TRANSITIONS='true' bundle exec rake test
ACTIVERECORD_VERSION='4.1' ENABLE_TRANSITIONS='false' bundle exec rake test

ACTIVERECORD_VERSION='4.2' bundle update
ACTIVERECORD_VERSION='4.2' bundle exec rake test
ACTIVERECORD_VERSION='4.2' ENABLE_TRANSITIONS='true' bundle exec rake test
ACTIVERECORD_VERSION='4.2' ENABLE_TRANSITIONS='false' bundle exec rake test

ACTIVERECORD_VERSION='5.0' bundle update
ACTIVERECORD_VERSION='5.0' bundle exec rake test
ACTIVERECORD_VERSION='5.0' ENABLE_TRANSITIONS='true' bundle exec rake test
ACTIVERECORD_VERSION='5.0' ENABLE_TRANSITIONS='false' bundle exec rake test

ACTIVERECORD_VERSION='5.1' bundle update
ACTIVERECORD_VERSION='5.1' bundle exec rake test
ACTIVERECORD_VERSION='5.1' ENABLE_TRANSITIONS='true' bundle exec rake test
ACTIVERECORD_VERSION='5.1' ENABLE_TRANSITIONS='false' bundle exec rake test

if [[ ! $ruby_v =~ '2.2.0' ]]; then
ACTIVERECORD_VERSION='5.2' bundle update
ACTIVERECORD_VERSION='5.2' ENABLE_TRANSITIONS='false' bundle exec rake test
ACTIVERECORD_VERSION='5.2' ENABLE_TRANSITIONS='true' bundle exec rake test
ACTIVERECORD_VERSION='5.2' ENABLE_TRANSITIONS='false' bundle exec rake test
fi

if [[ $ruby_v =~ '2.5.' ]] || [[ $ruby_v =~ '2.6.' ]] || [[ $ruby_v =~ '2.7.' ]]; then
ACTIVERECORD_VERSION='6.0' bundle update
ACTIVERECORD_VERSION='6.0' ENABLE_TRANSITIONS='false' bundle exec rake test
ACTIVERECORD_VERSION='6.0' ENABLE_TRANSITIONS='true' bundle exec rake test
ACTIVERECORD_VERSION='6.0' ENABLE_TRANSITIONS='false' bundle exec rake test
fi

bundle update
ENABLE_TRANSITIONS='false' bundle exec rake test
ENABLE_TRANSITIONS='true' bundle exec rake test
ENABLE_TRANSITIONS='false' bundle exec rake test
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ The main project goals are:
Version | Documentation
--------- | -------------
unreleased| https://github.com/serradura/u-case/blob/main/README.md
4.2.0 | https://github.com/serradura/u-case/blob/v4.x/README.md
4.2.1 | https://github.com/serradura/u-case/blob/v4.x/README.md
3.1.0 | https://github.com/serradura/u-case/blob/v3.x/README.md
2.6.0 | https://github.com/serradura/u-case/blob/v2.x/README.md
1.1.0 | https://github.com/serradura/u-case/blob/v1.x/README.md
Expand Down Expand Up @@ -102,7 +102,7 @@ unreleased| https://github.com/serradura/u-case/blob/main/README.md
| u-case | branch | ruby | activemodel | u-attributes |
| -------------- | ------- | -------- | ------------- | ------------ |
| unreleased | main | >= 2.2.0 | >= 3.2, < 6.1 | ~> 2.0 |
| 4.2.0 | v4.x | >= 2.2.0 | >= 3.2, < 6.1 | ~> 2.0 |
| 4.2.1 | v4.x | >= 2.2.0 | >= 3.2, < 6.1 | ~> 2.0 |
| 3.1.0 | v3.x | >= 2.2.0 | >= 3.2, < 6.1 | ~> 1.1 |
| 2.6.0 | v2.x | >= 2.2.0 | >= 3.2, < 6.1 | ~> 1.1 |
| 1.1.0 | v1.x | >= 2.2.0 | >= 3.2, < 6.1 | ~> 1.1 |
Expand Down
4 changes: 2 additions & 2 deletions README.pt-BR.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Principais objetivos deste projeto:
Versão | Documentação
--------- | -------------
unreleased| https://github.com/serradura/u-case/blob/main/README.md
4.2.0 | https://github.com/serradura/u-case/blob/v4.x/README.md
4.2.1 | https://github.com/serradura/u-case/blob/v4.x/README.md
3.1.0 | https://github.com/serradura/u-case/blob/v3.x/README.md
2.6.0 | https://github.com/serradura/u-case/blob/v2.x/README.md
1.1.0 | https://github.com/serradura/u-case/blob/v1.x/README.md
Expand Down Expand Up @@ -100,7 +100,7 @@ unreleased| https://github.com/serradura/u-case/blob/main/README.md

| u-case | branch | ruby | activemodel | u-attributes |
| -------------- | ------- | -------- | ------------- | ------------ |
| 4.2.0 | main | >= 2.2.0 | >= 3.2, < 6.1 | ~> 2.0 |
| 4.2.1 | main | >= 2.2.0 | >= 3.2, < 6.1 | ~> 2.0 |
| 3.1.0 | v3.x | >= 2.2.0 | >= 3.2, < 6.1 | ~> 1.1 |
| 2.6.0 | v2.x | >= 2.2.0 | >= 3.2, < 6.1 | ~> 1.1 |
| 1.1.0 | v1.x | >= 2.2.0 | >= 3.2, < 6.1 | ~> 1.1 |
Expand Down
2 changes: 1 addition & 1 deletion lib/micro/case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def self.inspect
ids = (Thread.current[InspectKey] ||= [])

if ids.include?(object_id)
return sprintf('#<%s: {...}>', self)
return sprintf('#<%s: ...>', self)
end

begin
Expand Down
2 changes: 1 addition & 1 deletion lib/micro/case/result.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def inspect
instance_info = '%s (%s) type=:%s data=%s' % [pretty_type, self.class, @type, data]
transitions_info = ' transitions=%d' % [@__transitions.size] if Micro::Case::Result.transitions_enabled?

"<#{instance_info}#{transitions_info}>"
"#<#{instance_info}#{transitions_info}>"
end

def to_ary
Expand Down
2 changes: 1 addition & 1 deletion lib/micro/case/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Micro
class Case
VERSION = '4.2.0'.freeze
VERSION = '4.2.1'.freeze
end
end
2 changes: 1 addition & 1 deletion lib/micro/cases/flow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def initialize(use_cases)
end

def inspect
'<(%s) use_cases=%s>' % [self.class, @use_cases]
'#<(%s) use_cases=%s>' % [self.class, @use_cases]
end

def call!(input:, result:)
Expand Down
8 changes: 4 additions & 4 deletions test/micro/case/result_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,13 @@ def test_inspect
failure_result = failure_result(value: { number: 0 }, type: :error)

if Micro::Case::Result.transitions_enabled?
assert_equal('<Success (Micro::Case::Result) type=:ok data={:number=>1} transitions=1>', success_result.inspect)
assert_equal('#<Success (Micro::Case::Result) type=:ok data={:number=>1} transitions=1>', success_result.inspect)

assert_equal('<Failure (Micro::Case::Result) type=:error data={:number=>0} transitions=1>', failure_result.inspect)
assert_equal('#<Failure (Micro::Case::Result) type=:error data={:number=>0} transitions=1>', failure_result.inspect)
else
assert_equal('<Success (Micro::Case::Result) type=:ok data={:number=>1}>', success_result.inspect)
assert_equal('#<Success (Micro::Case::Result) type=:ok data={:number=>1}>', success_result.inspect)

assert_equal('<Failure (Micro::Case::Result) type=:error data={:number=>0}>', failure_result.inspect)
assert_equal('#<Failure (Micro::Case::Result) type=:error data={:number=>0}>', failure_result.inspect)
end
end
end
2 changes: 1 addition & 1 deletion test/micro/case/with_inner_flow_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def test_the_inheritance_violation

def test_the_inspect
assert_equal(
'<Micro::Case::WithInnerFlowTest::Double (Micro::Cases::Flow) use_cases=[<Micro::Case::WithInnerFlowTest::ConvertTextToNumber (Micro::Case) attributes=["text"]>, #<Micro::Case::WithInnerFlowTest::Double: {...}>, <Micro::Case::WithInnerFlowTest::ConvertNumberToText (Micro::Case) attributes=["number"]>]>',
'<Micro::Case::WithInnerFlowTest::Double (Micro::Cases::Flow) use_cases=[<Micro::Case::WithInnerFlowTest::ConvertTextToNumber (Micro::Case) attributes=["text"]>, #<Micro::Case::WithInnerFlowTest::Double: ...>, <Micro::Case::WithInnerFlowTest::ConvertNumberToText (Micro::Case) attributes=["number"]>]>',
Double.inspect
)
end
Expand Down
2 changes: 1 addition & 1 deletion test/micro/cases/flow/blend_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def test_result_must_be_a_failure

def test_inspect
assert_equal(
'<(Micro::Cases::Flow) use_cases=[<Steps::ConvertToNumbers (Micro::Case) attributes=["numbers"]>, <Steps::Add2 (Micro::Case::Strict) attributes=["numbers"]>]>',
'#<(Micro::Cases::Flow) use_cases=[<Steps::ConvertToNumbers (Micro::Case) attributes=["numbers"]>, <Steps::Add2 (Micro::Case::Strict) attributes=["numbers"]>]>',
Add2ToAllNumbers.inspect
)

Expand Down
2 changes: 1 addition & 1 deletion test/micro/cases/safe/flow/blend_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_that_raises_wrong_usage_exceptions

def test_inspect
assert_equal(
'<(Micro::Cases::Safe::Flow) use_cases=[<Steps::ConvertToNumbers (Micro::Case) attributes=["numbers"]>, <Steps::Add2 (Micro::Case::Strict) attributes=["numbers"]>]>',
'#<(Micro::Cases::Safe::Flow) use_cases=[<Steps::ConvertToNumbers (Micro::Case) attributes=["numbers"]>, <Steps::Add2 (Micro::Case::Strict) attributes=["numbers"]>]>',
Add2ToAllNumbers.inspect
)

Expand Down

0 comments on commit 4499cb5

Please sign in to comment.