activeresource icon indicating copy to clipboard operation
activeresource copied to clipboard

The test suite is not stable and test cases can't be executed independently

Open voxik opened this issue 2 years ago • 0 comments

Trying to execute just part of the test suite, it fails with following error:

$ ruby -Ilib:test -e 'Dir.glob "./test/**/authorization_test.rb", &method(:require)'
Run options: --seed 50377

# Running:

EEEE.......EE.EE...........

Finished in 0.024559s, 1099.3723 runs/s, 1750.8522 assertions/s.

  1) Error:
BasicAuthorizationTest#test_authorization_header_with_username_but_no_password:
NameError: uninitialized constant Base64

    assert_equal ["david"], ::Base64.decode64(authorization[1]).split(":")[0..1]
                            ^^^^^^^^
    /builddir/build/BUILD/activeresource-6.0.0/usr/share/gems/gems/activeresource-6.0.0/test/cases/authorization_test.rb:94:in `test_authorization_header_with_username_but_no_password'

  2) Error:
BasicAuthorizationTest#test_authorization_header_with_password_but_no_username:
NameError: uninitialized constant Base64

    assert_equal ["", "test123"], ::Base64.decode64(authorization[1]).split(":")[0..1]
                                  ^^^^^^^^
    /builddir/build/BUILD/activeresource-6.0.0/usr/share/gems/gems/activeresource-6.0.0/test/cases/authorization_test.rb:103:in `test_authorization_header_with_password_but_no_username'

  3) Error:
BasicAuthorizationTest#test_authorization_header:
NameError: uninitialized constant Base64

    assert_equal ["david", "test123"], ::Base64.decode64(authorization[1]).split(":")[0..1]
                                       ^^^^^^^^
    /builddir/build/BUILD/activeresource-6.0.0/usr/share/gems/gems/activeresource-6.0.0/test/cases/authorization_test.rb:85:in `test_authorization_header'

  4) Error:
BasicAuthorizationTest#test_authorization_header_with_decoded_credentials_from_url:
NameError: uninitialized constant Base64

    assert_equal ["[email protected]", "123"], ::Base64.decode64(authorization[1]).split(":")[0..1]
                                          ^^^^^^^^
    /builddir/build/BUILD/activeresource-6.0.0/usr/share/gems/gems/activeresource-6.0.0/test/cases/authorization_test.rb:112:in `test_authorization_header_with_decoded_credentials_from_url'

  5) Error:
BasicAuthorizationTest#test_authorization_header_explicitly_setting_password_but_no_username:
NameError: uninitialized constant Base64

    assert_equal ["", "test123"], ::Base64.decode64(authorization[1]).split(":")[0..1]
                                  ^^^^^^^^
    /builddir/build/BUILD/activeresource-6.0.0/usr/share/gems/gems/activeresource-6.0.0/test/cases/authorization_test.rb:144:in `test_authorization_header_explicitly_setting_password_but_no_username'

  6) Error:
BasicAuthorizationTest#test_authorization_header_explicitly_setting_username_but_no_password:
NameError: uninitialized constant Base64

    assert_equal ["david"], ::Base64.decode64(authorization[1]).split(":")[0..1]
                            ^^^^^^^^
    /builddir/build/BUILD/activeresource-6.0.0/usr/share/gems/gems/activeresource-6.0.0/test/cases/authorization_test.rb:134:in `test_authorization_header_explicitly_setting_username_but_no_password'

  7) Error:
BasicAuthorizationTest#test_authorization_header_explicitly_setting_username_and_password:
NameError: uninitialized constant Base64

    assert_equal ["david", "test123"], ::Base64.decode64(authorization[1]).split(":")[0..1]
                                       ^^^^^^^^
    /builddir/build/BUILD/activeresource-6.0.0/usr/share/gems/gems/activeresource-6.0.0/test/cases/authorization_test.rb:124:in `test_authorization_header_explicitly_setting_username_and_password'

  8) Error:
BasicAuthorizationTest#test_authorization_header_if_credentials_supplied_and_auth_type_is_basic:
NameError: uninitialized constant Base64

    assert_equal ["david", "test123"], ::Base64.decode64(authorization[1]).split(":")[0..1]
                                       ^^^^^^^^
    /builddir/build/BUILD/activeresource-6.0.0/usr/share/gems/gems/activeresource-6.0.0/test/cases/authorization_test.rb:153:in `test_authorization_header_if_credentials_supplied_and_auth_type_is_basic'

27 runs, 43 assertions, 0 failures, 8 errors, 0 skips

So this apparently need require 'base64' somewhere. Trying different combination, it fails differently (and the base64 is loaded`):

$ ruby -Ilib:test -e 'Dir.glob "./test/**/{finder,authorization}_test.rb", &method(:require)'
Run options: --seed 30422

# Running:

...E.....................E.............................

Finished in 0.074385s, 739.3967 runs/s, 1478.7934 assertions/s.

  1) Error:
FinderTest#test_find_all_by_symbol_from_with_prefix:
NoMethodError: undefined method `second' for [#<Pet:0x00007fe7ee815be0 @attributes={"id"=>1, "name"=>"Max"}, @prefix_options={:person_id=>1}, @persisted=true>, #<Pet:0x00007fe7ee815780 @attributes={"id"=>2, "name"=>"Daisy"}, @prefix_options={:person_id=>1}, @persisted=true>]:ActiveResource::Collection

    assert_equal "Daisy", pets.second.name
                              ^^^^^^^
Did you mean?  send
    /builddir/build/BUILD/activeresource-6.0.0/usr/share/gems/gems/activeresource-6.0.0/test/cases/finder_test.rb:177:in `test_find_all_by_symbol_from_with_prefix'

  2) Error:
FinderTest#test_find_all_by_from_with_prefix:
NoMethodError: undefined method `second' for [#<Pet:0x00007fe7ef03d930 @attributes={"id"=>1, "name"=>"Max"}, @prefix_options={:person_id=>1}, @persisted=true>, #<Pet:0x00007fe7ef03d2f0 @attributes={"id"=>2, "name"=>"Daisy"}, @prefix_options={:person_id=>1}, @persisted=true>]:ActiveResource::Collection

    assert_equal "Daisy", pets.second.name
                              ^^^^^^^
Did you mean?  send
    /builddir/build/BUILD/activeresource-6.0.0/usr/share/gems/gems/activeresource-6.0.0/test/cases/finder_test.rb:157:in `test_find_all_by_from_with_prefix'

55 runs, 110 assertions, 0 failures, 2 errors, 0 skips

voxik avatar Aug 30 '22 11:08 voxik