Skip to content

Audit and convert tests to test/unit (minitest) #121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 48 commits into from
Oct 14, 2014
Merged

Conversation

jch
Copy link
Member

@jch jch commented Oct 10, 2014

🚧 WIP 🚧

This PR converts the RSpec tests to minitest. Most of the tests were translated over, but I'll make inline notes where I modified or removed tests for clarity.

  • convert rspec tests to test/unit
  • rename 'test/common' to 'test/test_helper'
  • remove metaid dependency
  • remove rspec dependency
  • remove autotest
  • auto generate gemspec files manifest

# on them to work. Pipes are more robust for this test, so we'll skip
# the #connect call since it fails.
flexmock(OpenSSL::SSL::SSLSocket).
new_instances.should_receive(:connect => nil)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to remove flexmock and only use minitest/mock here, but I had some difficulty converting this test. It's not high priority, but if someone is interested in tackling it, feel free to talk to me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to rebuild this test to use a real socket instead of a pipe since this is why JRuby CI builds fail (mismatch between pipe and socket; thanks strong Java types/Obama). If this is passing as is, let's worry about replacing the mock and pipe later, and I'll assign myself to that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

search_result_ber.ber_identifier = Net::LDAP::PDU::SearchResult
search_result = [2, search_result_ber]
@tcp_socket.should_receive(:read_ber).and_return(search_data).
and_return(search_result)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would love to simplify this kind of construct or provide helpers at least. This general pattern is all over the tests.

mtodd added 4 commits October 12, 2014 02:13
Otherwise, we conflict with Net::LDAP instrumentation test class,
causing mysterious failures.

def raw_string(s)
# Conveniently, String#b only needs to be called when it exists
s.respond_to?(:b) ? s.b : s
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jch when moving the BER tests, we switched to using String#b but that is 2.0+ only and breaks the 1.9 build. We can either monkeypatch .b support (blech), bring this back, or work something a bit better out.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine with bringing this back. Took it out because I didn't know what it was for. I'll document that it's for 1.9 also.

@jch jch mentioned this pull request Oct 13, 2014
@jch
Copy link
Member Author

jch commented Oct 13, 2014

What's the reason to use Test::Unit::TestCase instead of Minitest::Test?

No strong reason, it was already in use, so I left it there. I've added minitest ~> 5.0 now as a test dependency and changed the test files to use Minitest::Test in 1168215

@jch
Copy link
Member Author

jch commented Oct 13, 2014

Unfortunately, flexmock doesn't have minitest support out of the box. There are 14 references to flexmock in the test suite. Ideally we'd convert these to use Minitest::Mock, but it'll take some thought because minitest does not support partial mocking. I'll stick with the older Test::Unit::TestCase adaptor until we get around to this.

@mtodd
Copy link
Member

mtodd commented Oct 14, 2014

@jch bah, OK. No worries, thanks for giving it a go. Don't mind taking point on that in a followup.

@mtodd
Copy link
Member

mtodd commented Oct 14, 2014

@jch alright, finished up the last bits. Give it look over and merge it when you're ready.

@jch
Copy link
Member Author

jch commented Oct 14, 2014

Still some failures with jruby-19mode, but we allow failures for that part of the build matrix. 🚢 ing!

jch added a commit that referenced this pull request Oct 14, 2014
Audit and convert tests to test/unit (minitest)
@jch jch merged commit db29964 into ruby-ldap:master Oct 14, 2014
@jch jch deleted the minitestify branch October 14, 2014 17:51
@mtodd
Copy link
Member

mtodd commented Oct 14, 2014

@jch those failures are consistent with master before this branch was
merged! :)

On Tuesday, October 14, 2014, Jerry Cheung notifications@github.com wrote:

Merged #121 #121.


Reply to this email directly or view it on GitHub
#121 (comment).

Matt Todd
GitHub, Inc
www.github.com
cell: 404-314-2612
blog: maraby.org

astratto pushed a commit to astratto/ruby-net-ldap that referenced this pull request Dec 18, 2015
astratto pushed a commit to astratto/ruby-net-ldap that referenced this pull request Dec 18, 2015
Audit and convert tests to test/unit (minitest)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants