diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9b20426 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,47 @@ +# This workflow runs continuous CI across different versions of ruby on all branches and pull requests to develop. + +name: CI + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the develop branch + push: + branches: [ '**' ] + pull_request: + branches: [ develop ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + tests: + name: Ruby ${{ matrix.ruby }} + if: "contains(github.event.commits[0].message, '[ci skip]') == false" + runs-on: ubuntu-latest + env: + CI: true + strategy: + fail-fast: false + matrix: + ruby: + - 2.4 + - 2.5 + - 2.6 + - 2.7 + - 3.0 + - ruby-head + - jruby + steps: + - name: Clone repository + uses: actions/checkout@v2 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + - name: Install dependencies + run: bundle install --jobs 4 --retry 3 + - name: Run tests + run: bundle exec rspec spec + diff --git a/.travis.yml b/.travis.yml index 83a126b..b5997e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,10 +7,12 @@ rvm: - 2.5 - 2.6 - 2.7 + - ruby-head - jruby cache: bundler sudo: false matrix: allow_failures: - rvm: jruby + - rvm: ruby-head dist: trusty diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 06403de..7e21071 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -28,9 +28,11 @@ This repository uses [Git Flow](https://github.com/nvie/gitflow) to manage devel enough, be assured we will eventually add you in there. * Do note that in order for us to merge any non-trivial changes (as a rule of thumb, additions larger than about 15 lines of code), we need an - explicit [public domain dedication][PDD] on record from you. + explicit [public domain dedication][PDD] on record from you, + which you will be asked to agree to on the first commit to a repo within the organization. + Note that the agreement applies to all repos in the [Ruby RDF](https://github.com/ruby-rdf/) organization. [YARD]: https://yardoc.org/ [YARD-GS]: https://rubydoc.info/docs/yard/file/docs/GettingStarted.md -[PDD]: https://lists.w3.org/Archives/Public/public-rdf-ruby/2010May/0013.html -[pr]: https://github.com/ruby-rdf/rdf-spec/compare/ +[PDD]: https://unlicense.org/#unlicensing-contributions +[pr]: https://github.com/ruby-rdf/rdf/compare/ diff --git a/Gemfile b/Gemfile index 6cf6ad2..a2d8307 100644 --- a/Gemfile +++ b/Gemfile @@ -10,6 +10,6 @@ group :debug do end group :development, :test do - gem 'simplecov', platforms: :mri - gem 'coveralls', '~> 0.8', platforms: :mri + gem 'simplecov', require: false, platforms: :mri + gem 'coveralls', require: false, platforms: :mri end \ No newline at end of file diff --git a/README.md b/README.md index ec49636..64252f2 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,10 @@ This is an [RDF.rb][] extension that provides RDF-specific [RSpec][] matchers and shared examples for Ruby projects that use RDF.rb and RSpec. -* - [![Gem Version](https://badge.fury.io/rb/rdf-spec.png)](https://badge.fury.io/rb/rdf-spec) -[![Build Status](https://travis-ci.org/ruby-rdf/rdf-spec.png?branch=master)](https://travis-ci.org/ruby-rdf/rdf-spec) -[![Coverage Status](https://coveralls.io/repos/ruby-rdf/rdf-spec/badge.svg)](https://coveralls.io/r/ruby-rdf/rdf-spec) +[![Build Status](https://github.com/ruby-rdf/rdf-spec/workflows/CI/badge.svg?branch=develop)](https://github.com/ruby-rdf/rdf-spec/actions?query=workflow%3ACI) +[![Coverage Status](https://coveralls.io/repos/ruby-rdf/rdf-spec/badge.svg)](https://coveralls.io/github/ruby-rdf/rdf-spec) +[![Gitter chat](https://badges.gitter.im/ruby-rdf/rdf.png)](https://gitter.im/ruby-rdf/rdf) ## Documentation @@ -76,7 +75,9 @@ follows: enough, be assured we will eventually add you in there. * Do note that in order for us to merge any non-trivial changes (as a rule of thumb, additions larger than about 15 lines of code), we need an - explicit [public domain dedication][PDD] on record from you. + explicit [public domain dedication][PDD] on record from you, + which you will be asked to agree to on the first commit to a repo within the organization. + Note that the agreement applies to all repos in the [Ruby RDF](https://github.com/ruby-rdf/) organization. License ------- @@ -87,4 +88,4 @@ see or the accompanying {file:UNLICENSE} file. [RDF.rb]: https://rubygems.org/gems/rdf [RSpec]: https://rspec.info/ [RubySpec]: https://rubyspec.org/wiki/rubyspec/Style_Guide -[PDD]: https://lists.w3.org/Archives/Public/public-rdf-ruby/2010May/0013.html +[PDD]: https://unlicense.org/#unlicensing-contributions diff --git a/VERSION b/VERSION index 94ff29c..ef538c2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.1.1 +3.1.2 diff --git a/lib/rdf/spec.rb b/lib/rdf/spec.rb index ae33acd..4242b55 100644 --- a/lib/rdf/spec.rb +++ b/lib/rdf/spec.rb @@ -87,7 +87,7 @@ def to_s end end logger.level = Logger::DEBUG - logger.formatter = lambda {|severity, datetime, progname, msg| "#{severity} #{msg}\n"} + logger.formatter = lambda {|severity, datetime, progname, msg| "%5s %s\n" % [severity, msg]} logger end end # Spec diff --git a/lib/rdf/spec/matchers.rb b/lib/rdf/spec/matchers.rb index e2eeec3..e3bd4f7 100644 --- a/lib/rdf/spec/matchers.rb +++ b/lib/rdf/spec/matchers.rb @@ -266,16 +266,16 @@ def io_name end end - Info = Struct.new(:id, :logger, :action, :result, :format) + Info = Struct.new(:id, :logger, :action, :result, :format, :base, :prefixes) RSpec::Matchers.define :be_equivalent_graph do |expected, info| match do |actual| @info = if (info.id rescue false) info elsif info.is_a?(Logger) - Info.new("", info) + Info.new(logger: info) elsif info.is_a?(Hash) - Info.new(info[:id], info[:logger], info[:action], info[:result], info[:format]) + Info.new(info[:id], info[:logger], info[:action], info[:result], info[:format], info[:base], info[:prefixes]) else Info.new(info) end @@ -290,6 +290,13 @@ def io_name end failure_message do |actual| + dump_opts = { + standard_prefixes: true, + literal_shorthand: false, + validate: false, + base_uri: @info.base, + prefixes: @info.prefixes + } info = @info.respond_to?(:information) ? @info.information : @info.inspect if @expected.is_a?(RDF::Enumerable) && @actual.size != @expected.size "Graph entry counts differ:\nexpected: #{@expected.size}\nactual: #{@actual.size}\n" @@ -297,12 +304,19 @@ def io_name "Graphs differ\n" end + "\n#{info + "\n" unless info.empty?}" + - "Expected:\n#{@expected.dump(@info.format, standard_prefixes: true, literal_shorthand: false, validate: false) rescue @expected.inspect}" + - "Results:\n#{@actual.dump(@info.format, standard_prefixes: true, literal_shorthand: false, validate: false) rescue @actual.inspect}" + + "Expected:\n#{@expected.dump(@info.format, **dump_opts) rescue @expected.inspect}" + + "Results:\n#{@actual.dump(@info.format, **dump_opts) rescue @actual.inspect}" + "\nDebug:\n#{@info.logger}" end failure_message_when_negated do |actual| + dump_opts = { + standard_prefixes: true, + literal_shorthand: false, + validate: false, + base: @info.base, + prefixes: @info.prefixes + } format = case when RDF.const_defined?(:TriG) then :trig when RDF.const_defined?(:Turtle) then :ttl @@ -311,7 +325,7 @@ def io_name info = @info.respond_to?(:information) ? @info.information : @info.inspect "Graphs identical\n" + "\n#{info + "\n" unless info.empty?}" + - "Results:\n#{actual.dump(@info.format, standard_prefixes: true, literal_shorthand: false, validate: false) rescue @actual.inspect}" + + "Results:\n#{actual.dump(@info.format, **dump_opts) rescue @actual.inspect}" + "\nDebug:\n#{@info.logger}" end diff --git a/rdf-spec.gemspec b/rdf-spec.gemspec index 17aa173..2ea44e2 100755 --- a/rdf-spec.gemspec +++ b/rdf-spec.gemspec @@ -20,12 +20,13 @@ Gem::Specification.new do |gem| gem.required_ruby_version = '>= 2.4' gem.requirements = [] - gem.add_runtime_dependency 'rdf', '~> 3.1' + gem.add_runtime_dependency 'rdf', '~> 3.1', '>= 3.1.8' gem.add_runtime_dependency 'awesome_print', '~> 1.8' gem.add_runtime_dependency 'rdf-isomorphic', '~> 3.1' gem.add_runtime_dependency 'rspec', '~> 3.9' gem.add_runtime_dependency 'rspec-its', '~> 1.3' + gem.add_runtime_dependency 'rexml', '~> 3.2' # For Webmock gem.add_runtime_dependency 'webmock', '~> 3.7' - gem.add_development_dependency 'yard' , '~> 0.9.20' + gem.add_development_dependency 'yard' , '~> 0.9' gem.post_install_message = nil end