You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jens Geyer (Jira)" <ji...@apache.org> on 2019/10/05 16:31:00 UTC

[jira] [Commented] (THRIFT-4971) Fix lib/rb/spec/union_spec.rb so that CI succeeds

    [ https://issues.apache.org/jira/browse/THRIFT-4971?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16945101#comment-16945101 ] 

Jens Geyer commented on THRIFT-4971:
------------------------------------

Are you gouing to prepare PRs for all these tickets?

> Fix lib/rb/spec/union_spec.rb so that CI succeeds
> -------------------------------------------------
>
>                 Key: THRIFT-4971
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4971
>             Project: Thrift
>          Issue Type: Bug
>          Components: Ruby - Library
>            Reporter: Kengo Seki
>            Priority: Major
>
> I found that recent CI jobs failed with the following error:
> {code}
> Failures:
>   1) Union Thrift::Union should raise for wrong set field when hash initialized and type checking is off
>      Failure/Error: expect(example).to raise_error(RuntimeError, "set_field is not valid for this union!")
>        You must pass a block rather than an argument to `expect` to use the provided block expectation matcher (raise RuntimeError with "set_field is not valid for this union!").
>      # ./spec/union_spec.rb:55:in `block (3 levels) in <top (required)>'
> {code}
> rspec-expectations 3.8.5 was released three or four days ago, and it probably caused this error. In accordance with the message, the test case in question should be fixed as follows,
> {code}
>      it "should raise for wrong set field when hash initialized and type checking is off" do
>        Thrift.type_checking = false
>        union = SpecNamespace::My_union.new({incorrect_field: :incorrect})
> -      example = lambda { Thrift::Serializer.new.serialize(union) }
> -      expect(example).to raise_error(RuntimeError, "set_field is not valid for this union!")
> +      expect { Thrift::Serializer.new.serialize(union) }.to raise_error(RuntimeError, "set_field is not valid for this union!")
>      end
> {code}
> just as the previous test case does as follows:
> {code}
>     it "should raise for wrong set field" do
>       union = SpecNamespace::My_union.new
>       union.integer32 = 25
>       expect { union.some_characters }.to raise_error(RuntimeError, "some_characters is not union's set field.")
>     end
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)