Skip to content

Commit

Permalink
Finish 3.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
gkellogg committed Dec 25, 2020
2 parents 74a6600 + ab7c255 commit 918f701
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 21 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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

2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 5 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

* <https://github.com/ruby-rdf/rdf-spec>

[![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

Expand Down Expand Up @@ -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
-------
Expand All @@ -87,4 +88,4 @@ see <https://unlicense.org/> 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
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.1
3.1.2
2 changes: 1 addition & 1 deletion lib/rdf/spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 20 additions & 6 deletions lib/rdf/spec/matchers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -290,19 +290,33 @@ 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"
else
"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
Expand All @@ -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

Expand Down
5 changes: 3 additions & 2 deletions rdf-spec.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 918f701

Please sign in to comment.