guard / rb-inotify

A thorough inotify wrapper for Ruby using FFI.
MIT License
312 stars 64 forks source link

Add test environment. #63

Closed junaruga closed 7 years ago

junaruga commented 7 years ago

This fixes #62 .

This is a use case to test.

$ ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]

$ bundle -v
Bundler version 1.14.6

$ git clone git@github.com:nex3/rb-inotify.git

$ cd rb-inotify

$ bundle install --path vendor/bundle

$ bundle list
Gems included by the bundle:
  * addressable (2.5.1)
  * builder (3.2.3)
  * bundler (1.14.6)
  * descendants_tracker (0.0.4)
  * faraday (0.9.2)
  * ffi (1.9.18)
  * git (1.3.0)
  * github_api (0.11.3)
  * hashie (3.5.5)
  * highline (1.7.8)
  * jeweler (2.3.3)
  * jwt (1.5.6)
  * mini_portile2 (2.1.0)
  * minitest (5.10.1)
  * multi_json (1.12.1)
  * multi_xml (0.6.0)
  * multipart-post (2.0.0)
  * nokogiri (1.6.8.1)
  * oauth2 (1.3.1)
  * psych (2.2.4)
  * public_suffix (2.0.5)
  * rack (2.0.1)
  * rake (12.0.0)
  * rb-inotify (0.9.8)
  * rdoc (5.1.0)
  * semver2 (3.4.2)
  * thread_safe (0.3.6)
  * yard (0.9.8)

$ bundle exec rake -T
...
rake test                # Run tests
...

$ bundle exec rake test
...
1 runs, 1 assertions, 0 failures, 0 errors, 0 skips

I also prepared a file .travis.yml to test it on Traivs CI. This integration CI is often used for the ruby gem packages. I added officially supported rubies in it. I also added ruby-head as allow_failures. This is good practice. Because we can see the the result of the new version Ruby and prepare in advance. We can support the next version as faster.

We can see this kind of logic in rails, rspec and cucumber and etc. https://github.com/rails/rails/blob/master/.travis.yml https://github.com/rspec/rspec-core/blob/master/.travis.yml https://github.com/cucumber/cucumber-ruby/blob/master/.travis.yml

So, we can start testing with Travis CI too after you will activate it from below URL. https://travis-ci.org/nex3/rb-inotify

ioquatix commented 7 years ago

This is awesome. I'd prefer if we use RSpec. Is that possible?

junaruga commented 7 years ago

@ioquatix Thanks. I am happy that you like it. Yes, I can replace Minitest to RSpec. Please wait a moment. I will replace it.

ioquatix commented 7 years ago

Thanks so much for your quick reply. You are so awesome and I'm looking forward to the PR.

junaruga commented 7 years ago

@ioquatix I replaced to RSpec! I also did rebase on latest master branch.

junaruga commented 7 years ago

Use case is

$ bundle install --path vendor/bundle

$ bundle list
Gems included by the bundle:
  * addressable (2.5.1)
  * builder (3.2.3)
  * bundler (1.14.6)
  * descendants_tracker (0.0.4)
  * diff-lcs (1.3)
  * faraday (0.9.2)
  * ffi (1.9.18)
  * git (1.3.0)
  * github_api (0.11.3)
  * hashie (3.5.5)
  * highline (1.7.8)
  * jeweler (2.3.5)
  * jwt (1.5.6)
  * mini_portile2 (2.1.0)
  * multi_json (1.12.1)
  * multi_xml (0.6.0)
  * multipart-post (2.0.0)
  * nokogiri (1.6.8.1)
  * oauth2 (1.3.1)
  * psych (2.2.4)
  * public_suffix (2.0.5)
  * rack (2.0.3)
  * rake (12.0.0)
  * rb-inotify (0.9.8)
  * rdoc (5.1.0)
  * rspec (3.6.0)
  * rspec-core (3.6.0)
  * rspec-expectations (3.6.0)
  * rspec-mocks (3.6.0)
  * rspec-support (3.6.0)
  * semver2 (3.4.2)
  * thread_safe (0.3.6)
  * yard (0.9.9)

$ bundle exec rake -T
rake build               # Build gem into pkg/
rake clean               # Remove any temporary products
rake clobber             # Remove any generated files
rake console[script]     # Start IRB with all runtime dependencies loaded
rake gemspec             # Generate and validate gemspec
rake gemspec:debug       # Display the gemspec for debugging purposes, as jeweler knows i...
rake gemspec:generate    # Regenerate the gemspec on the filesystem
rake gemspec:release     # Regenerate and validate gemspec, and then commits and pushes t...
rake gemspec:validate    # Validates the gemspec on the filesystem
rake git:release         # Tag and push release to git
rake install             # Build and install gem using `gem install`
rake release             # Release gem
rake rubygems:release    # Release gem to Gemcutter
rake spec                # Run RSpec code examples
rake version             # Displays the current version
rake version:bump:major  # Bump the major version by 1
rake version:bump:minor  # Bump the a minor version by 1
rake version:bump:patch  # Bump the patch version by 1
rake version:write       # Writes out an explicit version
rake yard                # Generate YARD Documentation

$ bundle exec rake
/usr/local/ruby-2.4.1/bin/ruby -w -I/home/jaruga/git/rb-inotify/vendor/bundle/ruby/2.4.0/gems/rspec-core-3.6.0/lib:/home/jaruga/git/rb-inotify/vendor/bundle/ruby/2.4.0/gems/rspec-support-3.6.0/lib /home/jaruga/git/rb-inotify/vendor/bundle/ruby/2.4.0/gems/rspec-core-3.6.0/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
..

Finished in 0.0027 seconds (files took 0.07523 seconds to load)
2 examples, 0 failures
ioquatix commented 7 years ago

@junaruga your contribution is greatly appreciated. May Ruby be with you.

junaruga commented 7 years ago

@ioquatix you are welcome. Let's start Travis test. People may send pull-request with the unit test code.

Maybe you have to enable Travis by yourself for that.

The Travis URL is https://travis-ci.org/nex3/rb-inotify or https://travis-ci.org/ioquatix/rb-inotify