Hello community, here is the log from the commit of package rubygem-mustermann-grape for openSUSE:Factory checked in at 2020-03-07 21:39:08 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-mustermann-grape (Old) and /work/SRC/openSUSE:Factory/.rubygem-mustermann-grape.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-mustermann-grape" Sat Mar 7 21:39:08 2020 rev:2 rq:773799 version:1.0.1 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-mustermann-grape/rubygem-mustermann-grape.changes 2018-02-06 16:50:50.623322946 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-mustermann-grape.new.26092/rubygem-mustermann-grape.changes 2020-03-07 21:39:12.440311398 +0100 @@ -1,0 +2,6 @@ +Mon Feb 10 15:13:59 UTC 2020 - Stephan Kulow <co...@suse.com> + +- updated to version 1.0.1 + no changelog found + +------------------------------------------------------------------- Old: ---- mustermann-grape-1.0.0.gem New: ---- mustermann-grape-1.0.1.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-mustermann-grape.spec ++++++ --- /var/tmp/diff_new_pack.SD1rJd/_old 2020-03-07 21:39:14.640312883 +0100 +++ /var/tmp/diff_new_pack.SD1rJd/_new 2020-03-07 21:39:14.644312886 +0100 @@ -1,7 +1,7 @@ # # spec file for package rubygem-mustermann-grape # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,19 +12,32 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +# +# This file was generated with a gem2rpm.yml and not just plain gem2rpm. +# All sections marked as MANUAL, license headers, summaries and descriptions +# can be maintained in that file. Please consult this file before editing any +# of those fields # Name: rubygem-mustermann-grape -Version: 1.0.0 +Version: 1.0.1 Release: 0 %define mod_name mustermann-grape %define mod_full_name %{mod_name}-%{version} +# MANUAL +%if %{suse_version} < 1500 +%define rb_build_versions ruby24 +%endif +# /MANUAL BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildRequires: ruby-macros >= 5 BuildRequires: %{ruby >= 2.1.0} BuildRequires: %{rubygem gem2rpm} -Url: https://github.com/ruby-grape/mustermann-grape +BuildRequires: ruby-macros >= 5 +URL: https://github.com/ruby-grape/mustermann-grape Source: https://rubygems.org/gems/%{mod_full_name}.gem Source1: gem2rpm.yml Summary: Grape syntax for Mustermann ++++++ mustermann-grape-1.0.0.gem -> mustermann-grape-1.0.1.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.travis.yml new/.travis.yml --- old/.travis.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/.travis.yml 2020-01-09 21:24:08.000000000 +0100 @@ -0,0 +1,8 @@ +language: ruby + +rvm: + - 2.5 + - 2.6 + - 2.7 + +cache: bundler diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Gemfile new/Gemfile --- old/Gemfile 2017-03-04 19:18:05.000000000 +0100 +++ new/Gemfile 2020-01-09 21:24:08.000000000 +0100 @@ -1,4 +1,10 @@ +# frozen_string_literal: true + source 'https://rubygems.org' -gem 'support', git: 'g...@github.com:sinatra/mustermann.git' +gem 'support', git: 'https://github.com/sinatra/mustermann.git' + gemspec + +gem 'rake' +gem 'rspec-core' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Gemfile.lock new/Gemfile.lock --- old/Gemfile.lock 2017-03-04 19:18:05.000000000 +0100 +++ new/Gemfile.lock 2020-01-09 21:24:08.000000000 +0100 @@ -1,7 +1,9 @@ GIT - remote: g...@github.com:sinatra/mustermann.git - revision: 4e7221d7fbcbc897e05fa088909caface9e7280e + remote: https://github.com/sinatra/mustermann.git + revision: db86e25f786c717dbe937d862a5ba0d35a58797b specs: + mustermann (1.1.0) + ruby2_keywords (~> 0.0.1) support (0.0.1) addressable coveralls @@ -18,71 +20,79 @@ PATH remote: . specs: - mustermann-grape (1.0.0) - mustermann (~> 1.0.0) + mustermann-grape (1.0.1) + mustermann (>= 1.0.0) GEM remote: https://rubygems.org/ specs: - addressable (2.5.0) - public_suffix (~> 2.0, >= 2.0.2) - coveralls (0.8.15) - json (>= 1.8, < 3) - simplecov (~> 0.12.0) - term-ansicolor (~> 1.3) - thor (~> 0.19.1) - tins (>= 1.6.0, < 2) - diff-lcs (1.2.5) - docile (1.1.5) - json (2.0.2) - mustermann (1.0.0) - public_suffix (2.0.3) - rack (1.6.4) - rack-protection (1.5.3) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + coveralls (0.7.2) + multi_json (~> 1.3) + rest-client (= 1.6.7) + simplecov (>= 0.7) + term-ansicolor (= 1.2.2) + thor (= 0.18.1) + diff-lcs (1.3) + docile (1.3.2) + json (2.3.0) + mime-types (3.3.1) + mime-types-data (~> 3.2015) + mime-types-data (3.2019.1009) + multi_json (1.14.1) + public_suffix (4.0.2) + rack (1.6.12) + rack-protection (1.5.5) rack - rack-test (0.6.3) - rack (>= 1.0) - rake (11.3.0) - redcarpet (3.3.4) - rspec (3.5.0) - rspec-core (~> 3.5.0) - rspec-expectations (~> 3.5.0) - rspec-mocks (~> 3.5.0) - rspec-core (3.5.4) - rspec-support (~> 3.5.0) - rspec-expectations (3.5.0) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rake (13.0.1) + redcarpet (3.5.0) + rest-client (1.6.7) + mime-types (>= 1.16) + rspec (3.9.0) + rspec-core (~> 3.9.0) + rspec-expectations (~> 3.9.0) + rspec-mocks (~> 3.9.0) + rspec-core (3.9.1) + rspec-support (~> 3.9.1) + rspec-expectations (3.9.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.5.0) - rspec-its (1.2.0) + rspec-support (~> 3.9.0) + rspec-its (1.3.0) rspec-core (>= 3.0.0) rspec-expectations (>= 3.0.0) - rspec-mocks (3.5.0) + rspec-mocks (3.9.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.5.0) - rspec-support (3.5.0) - simplecov (0.12.0) - docile (~> 1.1.0) + rspec-support (~> 3.9.0) + rspec-support (3.9.2) + ruby2_keywords (0.0.1) + simplecov (0.17.1) + docile (~> 1.1) json (>= 1.8, < 3) simplecov-html (~> 0.10.0) - simplecov-html (0.10.0) - sinatra (1.4.7) + simplecov-html (0.10.2) + sinatra (1.4.8) rack (~> 1.5) rack-protection (~> 1.4) tilt (>= 1.3, < 3) - term-ansicolor (1.4.0) - tins (~> 1.0) - thor (0.19.1) - tilt (2.0.5) - tins (1.12.0) + term-ansicolor (1.2.2) + tins (~> 0.8) + thor (0.18.1) + tilt (2.0.10) + tins (0.13.2) tool (0.2.3) - yard (0.9.5) + yard (0.9.20) PLATFORMS ruby DEPENDENCIES mustermann-grape! + rake + rspec-core support! BUNDLED WITH - 1.14.3 + 2.1.2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2017-03-04 19:18:05.000000000 +0100 +++ new/README.md 2020-01-09 21:24:08.000000000 +0100 @@ -2,6 +2,8 @@ This gem implements the `grape` pattern type for Mustermann. +[![Build Status](https://travis-ci.org/ruby-grape/mustermann-grape.svg?branch=master)](https://travis-ci.org/ruby-grape/mustermann-grape) + ## Overview **Supported options:** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Rakefile new/Rakefile --- old/Rakefile 2017-03-04 19:18:05.000000000 +0100 +++ new/Rakefile 2020-01-09 21:24:08.000000000 +0100 @@ -1,2 +1,10 @@ +# frozen_string_literal: true + +require 'rubygems' +require 'bundler' +Bundler.setup :default, :test, :development + +Bundler::GemHelper.install_tasks + task(default: :rspec) task(:rspec) { ruby '-S rspec' } Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/mustermann/grape/version.rb new/lib/mustermann/grape/version.rb --- old/lib/mustermann/grape/version.rb 2017-03-04 19:18:05.000000000 +0100 +++ new/lib/mustermann/grape/version.rb 2020-01-09 21:24:08.000000000 +0100 @@ -1,7 +1,5 @@ -require 'mustermann/grape' +# frozen_string_literal: true -module Mustermann - class Grape - VERSION = '1.0.0' - end +module MustermannGrape + VERSION = '1.0.1' end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/mustermann/grape.rb new/lib/mustermann/grape.rb --- old/lib/mustermann/grape.rb 2017-03-04 19:18:05.000000000 +0100 +++ new/lib/mustermann/grape.rb 2020-01-09 21:24:08.000000000 +0100 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'mustermann' require 'mustermann/ast/pattern' @@ -12,23 +14,23 @@ class Grape < AST::Pattern register :grape - on(nil, ??, ?)) { |c| unexpected(c) } + on(nil, '?', ')') { |c| unexpected(c) } - on(?*) { |c| scan(/\w+/) ? node(:named_splat, buffer.matched) : node(:splat) } - on(?:) { |c| node(:capture, constraint: "[^/\\?#\.]") { scan(/\w+/) } } - on(?\\) { |c| node(:char, expect(/./)) } - on(?() { |c| node(:optional, node(:group) { read unless scan(?)) }) } - on(?|) { |c| node(:or) } + on('*') { |_c| scan(/\w+/) ? node(:named_splat, buffer.matched) : node(:splat) } + on(':') { |_c| node(:capture, constraint: "[^/\\?#\.]") { scan(/\w+/) } } + on('\\') { |_c| node(:char, expect(/./)) } + on('(') { |_c| node(:optional, node(:group) { read unless scan(')') }) } + on('|') { |_c| node(:or) } - on ?{ do |char| - type = scan(?+) ? :named_splat : :capture + on '{' do |_char| + type = scan('+') ? :named_splat : :capture name = expect(/[\w\.]+/) - type = :splat if type == :named_splat and name == 'splat' - expect(?}) + type = :splat if (type == :named_splat) && (name == 'splat') + expect('}') node(type, name) end - suffix ?? do |char, element| + suffix '?' do |_char, element| node(:optional, element) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2017-03-04 19:18:05.000000000 +0100 +++ new/metadata 2020-01-09 21:24:08.000000000 +0100 @@ -1,28 +1,29 @@ --- !ruby/object:Gem::Specification name: mustermann-grape version: !ruby/object:Gem::Version - version: 1.0.0 + version: 1.0.1 platform: ruby authors: - namusyaka - Konstantin Haase +- Daniel Doubrovkine autorequire: bindir: bin cert_chain: [] -date: 2017-03-04 00:00:00.000000000 Z +date: 2020-01-09 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: mustermann requirement: !ruby/object:Gem::Requirement requirements: - - - "~>" + - - ">=" - !ruby/object:Gem::Version version: 1.0.0 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - - "~>" + - - ">=" - !ruby/object:Gem::Version version: 1.0.0 description: Adds Grape style patterns to Mustermman @@ -31,6 +32,7 @@ extensions: [] extra_rdoc_files: [] files: +- ".travis.yml" - Gemfile - Gemfile.lock - README.md @@ -39,6 +41,7 @@ - lib/mustermann/grape/version.rb - mustermann-grape.gemspec - spec/grape_spec.rb +- spec/spec_helper.rb homepage: https://github.com/ruby-grape/mustermann-grape licenses: - MIT @@ -58,10 +61,10 @@ - !ruby/object:Gem::Version version: '0' requirements: [] -rubyforge_project: -rubygems_version: 2.6.8 +rubygems_version: 3.0.4 signing_key: specification_version: 4 summary: Grape syntax for Mustermann test_files: - spec/grape_spec.rb +- spec/spec_helper.rb diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mustermann-grape.gemspec new/mustermann-grape.gemspec --- old/mustermann-grape.gemspec 2017-03-04 19:18:05.000000000 +0100 +++ new/mustermann-grape.gemspec 2020-01-09 21:24:08.000000000 +0100 @@ -1,18 +1,21 @@ -$:.unshift File.expand_path("../lib", __FILE__) -require "mustermann/grape/version" +# frozen_string_literal: true + +$LOAD_PATH.push File.expand_path('lib', __dir__) + +require 'mustermann/grape/version' Gem::Specification.new do |s| - s.name = "mustermann-grape" - s.version = Mustermann::Grape::VERSION - s.authors = ["namusyaka", "Konstantin Haase"] - s.email = "namusy...@gmail.com" - s.homepage = "https://github.com/ruby-grape/mustermann-grape" - s.summary = %q{Grape syntax for Mustermann} - s.description = %q{Adds Grape style patterns to Mustermman} + s.name = 'mustermann-grape' + s.version = MustermannGrape::VERSION + s.authors = ['namusyaka', 'Konstantin Haase', 'Daniel Doubrovkine'] + s.email = 'namusy...@gmail.com' + s.homepage = 'https://github.com/ruby-grape/mustermann-grape' + s.summary = 'Grape syntax for Mustermann' + s.description = 'Adds Grape style patterns to Mustermman' s.license = 'MIT' s.required_ruby_version = '>= 2.1.0' s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") - s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } - s.add_dependency 'mustermann', '~> 1.0.0' + s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) } + s.add_dependency 'mustermann', '>= 1.0.0' end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/grape_spec.rb new/spec/grape_spec.rb --- old/spec/grape_spec.rb 2017-03-04 19:18:05.000000000 +0100 +++ new/spec/grape_spec.rb 2020-01-09 21:24:08.000000000 +0100 @@ -1,11 +1,13 @@ -# -*- encoding: utf-8 -*- +# frozen_string_literal: true + +require 'spec_helper' + require 'support/env' require 'support/match_matcher' require 'support/expand_matcher' require 'support/pattern' require 'support/generate_template_matcher' require 'support/scan_matcher' -require File.expand_path('lib/mustermann/grape') describe Mustermann::Grape do extend Support::Pattern @@ -59,11 +61,11 @@ end pattern '/föö' do - it { should match("/f%C3%B6%C3%B6") } + it { should match('/f%C3%B6%C3%B6') } end - pattern "/:foo/:bar" do - it { should match('/foo/bar') .capturing foo: 'foo', bar: 'bar' } + pattern '/:foo/:bar' do + it { should match('/foo/bar') .capturing foo: 'foo', bar: 'bar' } it { should_not match('/foo.bar/bar.foo') } it { should_not match('/u...@example.com/name') } it { should_not match('/10.1/te.st') } @@ -72,13 +74,13 @@ it { should_not match('/foo%2Fbar') } it { should_not match('/foo%2fbar') } - example { pattern.params('/bar/foo').should be == {"foo" => "bar", "bar" => "foo"} } + example { pattern.params('/bar/foo').should be == { 'foo' => 'bar', 'bar' => 'foo' } } example { pattern.params('').should be_nil } it { should generate_template('/{foo}/{bar}') } end - pattern "/{foo}/{bar}" do + pattern '/{foo}/{bar}' do it { should match('/foo/bar') .capturing foo: 'foo', bar: 'bar' } it { should match('/foo.bar/bar.foo') .capturing foo: 'foo.bar', bar: 'bar.foo' } it { should match('/u...@example.com/name') .capturing foo: 'u...@example.com', bar: 'name' } @@ -88,7 +90,7 @@ it { should_not match('/foo%2Fbar') } it { should_not match('/foo%2fbar') } - example { pattern.params('/bar/foo').should be == {"foo" => "bar", "bar" => "foo"} } + example { pattern.params('/bar/foo').should be == { 'foo' => 'bar', 'bar' => 'foo' } } example { pattern.params('').should be_nil } it { should generate_template('/{foo}/{bar}') } @@ -117,7 +119,7 @@ it { should_not expand(baz: '') } it { should_not match('/hello/world/') } - it { should generate_templates("", "/", "//", "//{bar}", "/{bar}", "/{foo}", "/{foo}/", "/{foo}/{bar}", "/{foo}{bar}", "{bar}", "{foo}", "{foo}/", "{foo}/{bar}", "{foo}{bar}") } + it { should generate_templates('', '/', '//', '//{bar}', '/{bar}', '/{foo}', '/{foo}/', '/{foo}/{bar}', '/{foo}{bar}', '{bar}', '{foo}', '{foo}/', '{foo}/{bar}', '{foo}{bar}') } end pattern '/:foo_bar' do @@ -126,7 +128,7 @@ end pattern '/{foo.bar}' do - it { should match('/hello').capturing :"foo.bar" => 'hello' } + it { should match('/hello').capturing "foo.bar": 'hello' } it { should generate_template('/{foo.bar}') } end @@ -136,7 +138,7 @@ it { should match('/foo/bar') .capturing splat: 'foo/bar' } it { should generate_template('/{+splat}') } - example { pattern.params('/foo').should be == {"splat" => ["foo"]} } + example { pattern.params('/foo').should be == { 'splat' => ['foo'] } } end pattern '/{+splat}' do @@ -145,7 +147,7 @@ it { should match('/foo/bar') .capturing splat: 'foo/bar' } it { should generate_template('/{+splat}') } - example { pattern.params('/foo').should be == {"splat" => ["foo"]} } + example { pattern.params('/foo').should be == { 'splat' => ['foo'] } } end pattern '/*foo' do @@ -154,8 +156,8 @@ it { should match('/foo/bar') .capturing foo: 'foo/bar' } it { should generate_template('/{+foo}') } - example { pattern.params('/foo') .should be == {"foo" => "foo" } } - example { pattern.params('/foo/bar') .should be == {"foo" => "foo/bar" } } + example { pattern.params('/foo') .should be == { 'foo' => 'foo' } } + example { pattern.params('/foo/bar') .should be == { 'foo' => 'foo/bar' } } end pattern '/{+foo}' do @@ -164,8 +166,8 @@ it { should match('/foo/bar') .capturing foo: 'foo/bar' } it { should generate_template('/{+foo}') } - example { pattern.params('/foo') .should be == {"foo" => "foo" } } - example { pattern.params('/foo/bar') .should be == {"foo" => "foo/bar" } } + example { pattern.params('/foo') .should be == { 'foo' => 'foo' } } + example { pattern.params('/foo/bar') .should be == { 'foo' => 'foo/bar' } } end pattern '/*foo/*bar' do @@ -179,25 +181,25 @@ end pattern '/:foo/*' do - it { should match("/foo/bar/baz") .capturing foo: 'foo', splat: 'bar/baz' } - it { should match("/foo/") .capturing foo: 'foo', splat: '' } + it { should match('/foo/bar/baz') .capturing foo: 'foo', splat: 'bar/baz' } + it { should match('/foo/') .capturing foo: 'foo', splat: '' } it { should match('/h%20w/h%20a%20y') .capturing foo: 'h%20w', splat: 'h%20a%20y' } it { should_not match('/foo') } it { should generate_template('/{foo}/{+splat}') } - example { pattern.params('/bar/foo').should be == {"splat" => ["foo"], "foo" => "bar"} } - example { pattern.params('/bar/foo/f%20o').should be == {"splat" => ["foo/f o"], "foo" => "bar"} } + example { pattern.params('/bar/foo').should be == { 'splat' => ['foo'], 'foo' => 'bar' } } + example { pattern.params('/bar/foo/f%20o').should be == { 'splat' => ['foo/f o'], 'foo' => 'bar' } } end pattern '/{foo}/*' do - it { should match("/foo/bar/baz") .capturing foo: 'foo', splat: 'bar/baz' } - it { should match("/foo/") .capturing foo: 'foo', splat: '' } + it { should match('/foo/bar/baz') .capturing foo: 'foo', splat: 'bar/baz' } + it { should match('/foo/') .capturing foo: 'foo', splat: '' } it { should match('/h%20w/h%20a%20y') .capturing foo: 'h%20w', splat: 'h%20a%20y' } it { should_not match('/foo') } it { should generate_template('/{foo}/{+splat}') } - example { pattern.params('/bar/foo').should be == {"splat" => ["foo"], "foo" => "bar"} } - example { pattern.params('/bar/foo/f%20o').should be == {"splat" => ["foo/f o"], "foo" => "bar"} } + example { pattern.params('/bar/foo').should be == { 'splat' => ['foo'], 'foo' => 'bar' } } + example { pattern.params('/bar/foo/f%20o').should be == { 'splat' => ['foo/f o'], 'foo' => 'bar' } } end pattern '/test$/' do @@ -210,7 +212,7 @@ it { should_not match('/teest/') } end - pattern "/path with spaces" do + pattern '/path with spaces' do it { should match('/path%20with%20spaces') } it { should match('/path%2Bwith%2Bspaces') } it { should match('/path+with+spaces') } @@ -229,15 +231,15 @@ pattern '/*/:foo/*/*' do it { should match('/bar/foo/bling/baz/boom') } - it "should capture all splat parts" do + it 'should capture all splat parts' do match = pattern.match('/bar/foo/bling/baz/boom') match.captures.should be == ['bar', 'foo', 'bling', 'baz/boom'] - match.names.should be == ['splat', 'foo'] + match.names.should be == %w[splat foo] end it 'should map to proper params' do pattern.params('/bar/foo/bling/baz/boom').should be == { - "foo" => "foo", "splat" => ['bar', 'bling', 'baz/boom'] + 'foo' => 'foo', 'splat' => ['bar', 'bling', 'baz/boom'] } end end @@ -245,15 +247,15 @@ pattern '/{+splat}/{foo}/{+splat}/{+splat}' do it { should match('/bar/foo/bling/baz/boom') } - it "should capture all splat parts" do + it 'should capture all splat parts' do match = pattern.match('/bar/foo/bling/baz/boom') match.captures.should be == ['bar', 'foo', 'bling', 'baz/boom'] - match.names.should be == ['splat', 'foo'] + match.names.should be == %w[splat foo] end it 'should map to proper params' do pattern.params('/bar/foo/bling/baz/boom').should be == { - "foo" => "foo", "splat" => ['bar', 'bling', 'baz/boom'] + 'foo' => 'foo', 'splat' => ['bar', 'bling', 'baz/boom'] } end end @@ -274,7 +276,7 @@ it { should match('/pony正%2ejpg') .capturing file: 'pony正', ext: 'jpg' } it { should_not match('/pony正..jpg') } - it { should_not match('/.jpg') } + it { should_not match('/.jpg') } end pattern '/(:a)x?' do @@ -287,7 +289,7 @@ end pattern '/:user(@:host)?' do - it { should match('/foo@bar') .capturing user: 'foo', host: 'bar' } + it { should match('/foo@bar') .capturing user: 'foo', host: 'bar' } it { should_not match('/foo.foo@bar') } it { should_not match('/f...@bar.bar') } @@ -318,12 +320,12 @@ end pattern '/10/:id' do - it { should match('/10/test') .capturing id: 'test' } + it { should match('/10/test') .capturing id: 'test' } it { should_not match('/10/te.st') } end pattern '/10.1/:id' do - it { should match('/10.1/test') .capturing id: 'test' } + it { should match('/10.1/test') .capturing id: 'test' } it { should_not match('/10.1/te.st') } end @@ -435,34 +437,34 @@ it { should match('/foo/bar/baz').capturing foo: 'foo', bar: 'bar', baz: 'baz' } end - pattern "/(foo|bar)" do - it { should match("/foo") } - it { should match("/bar") } + pattern '/(foo|bar)' do + it { should match('/foo') } + it { should match('/bar') } end - pattern "/(foo\\|bar)" do - it { should match "/foo%7Cbar" } - it { should generate_template "/foo%7Cbar" } + pattern '/(foo\\|bar)' do + it { should match '/foo%7Cbar' } + it { should generate_template '/foo%7Cbar' } - it { should_not match("/foo") } - it { should_not match("/bar") } + it { should_not match('/foo') } + it { should_not match('/bar') } it { should_not generate_template('/foo') } it { should_not generate_template('/bar') } end - pattern "/(:a/:b|:c)" do - it { should match("/foo") .capturing c: 'foo' } - it { should match("/foo/bar") .capturing a: 'foo', b: 'bar' } + pattern '/(:a/:b|:c)' do + it { should match('/foo') .capturing c: 'foo' } + it { should match('/foo/bar') .capturing a: 'foo', b: 'bar' } it { should expand(a: 'foo', b: 'bar') .to('/foo/bar') } it { should expand(c: 'foo') .to('/foo') } it { should_not expand(a: 'foo', b: 'bar', c: 'baz') } end - pattern "/:a/:b|:c" do - it { should match("foo") .capturing c: 'foo' } - it { should match("/foo/bar") .capturing a: 'foo', b: 'bar' } + pattern '/:a/:b|:c' do + it { should match('foo') .capturing c: 'foo' } + it { should match('/foo/bar') .capturing a: 'foo', b: 'bar' } it { should generate_template('/{a}/{b}') } it { should generate_template('{c}') } @@ -551,7 +553,7 @@ it { should_not match('/foo1') } end - pattern '/:file(.:ext)?', capture: { ext: ['jpg', 'png'] } do + pattern '/:file(.:ext)?', capture: { ext: %w[jpg png] } do it { should match('/pony') .capturing file: 'pony', ext: nil } it { should match('/pony.jpg') .capturing file: 'pony', ext: 'jpg' } it { should match('/pony%2Ejpg') .capturing file: 'pony', ext: 'jpg' } @@ -570,7 +572,7 @@ it { should match('/pony') .capturing file: 'pony', ext: nil } it { should match('/pony.jpg') .capturing file: 'pony', ext: '.jpg' } it { should match('/pony.png') .capturing file: 'pony', ext: '.png' } - it { should match('/pony.tar.gz') .capturing file: 'pony', ext: '.tar.gz' } + it { should match('/pony.tar.gz') .capturing file: 'pony', ext: '.tar.gz' } it { should_not match('/pony.png.jpg') } it { should_not match('/pony.jpg.png') } it { should_not match('/pony.gif') } @@ -618,14 +620,14 @@ it { should_not match('/foo%2fbar') } end - pattern "/path with spaces", uri_decode: false do + pattern '/path with spaces', uri_decode: false do it { should match('/path with spaces') } it { should_not match('/path%20with%20spaces') } it { should_not match('/path%2Bwith%2Bspaces') } it { should_not match('/path+with+spaces') } end - pattern "/path with spaces", space_matches_plus: false do + pattern '/path with spaces', space_matches_plus: false do it { should match('/path%20with%20spaces') } it { should_not match('/path%2Bwith%2Bspaces') } it { should_not match('/path+with+spaces') } @@ -633,81 +635,81 @@ context 'invalid syntax' do example 'unexpected closing parenthesis' do - expect { Mustermann::Grape.new('foo)bar') }. - to raise_error(Mustermann::ParseError, 'unexpected ) while parsing "foo)bar"') + expect { Mustermann::Grape.new('foo)bar') } + .to raise_error(Mustermann::ParseError, 'unexpected ) while parsing "foo)bar"') end example 'missing closing parenthesis' do - expect { Mustermann::Grape.new('foo(bar') }. - to raise_error(Mustermann::ParseError, 'unexpected end of string while parsing "foo(bar"') + expect { Mustermann::Grape.new('foo(bar') } + .to raise_error(Mustermann::ParseError, 'unexpected end of string while parsing "foo(bar"') end example 'missing unescaped closing parenthesis' do - expect { Mustermann::Grape.new('foo(bar\)') }. - to raise_error(Mustermann::ParseError, 'unexpected end of string while parsing "foo(bar\\\\)"') + expect { Mustermann::Grape.new('foo(bar\)') } + .to raise_error(Mustermann::ParseError, 'unexpected end of string while parsing "foo(bar\\\\)"') end example '? at beginning of route' do - expect { Mustermann::Grape.new('?foobar') }. - to raise_error(Mustermann::ParseError, 'unexpected ? while parsing "?foobar"') + expect { Mustermann::Grape.new('?foobar') } + .to raise_error(Mustermann::ParseError, 'unexpected ? while parsing "?foobar"') end example 'double ?' do - expect { Mustermann::Grape.new('foo??bar') }. - to raise_error(Mustermann::ParseError, 'unexpected ? while parsing "foo??bar"') + expect { Mustermann::Grape.new('foo??bar') } + .to raise_error(Mustermann::ParseError, 'unexpected ? while parsing "foo??bar"') end example 'dangling escape' do - expect { Mustermann::Grape.new('foo\\') }. - to raise_error(Mustermann::ParseError, 'unexpected end of string while parsing "foo\\\\"') + expect { Mustermann::Grape.new('foo\\') } + .to raise_error(Mustermann::ParseError, 'unexpected end of string while parsing "foo\\\\"') end end context 'invalid capture names' do example 'empty name' do - expect { Mustermann::Grape.new('/:/') }. - to raise_error(Mustermann::CompileError, "capture name can't be empty: \"/:/\"") + expect { Mustermann::Grape.new('/:/') } + .to raise_error(Mustermann::CompileError, "capture name can't be empty: \"/:/\"") end example 'named splat' do - expect { Mustermann::Grape.new('/:splat/') }. - to raise_error(Mustermann::CompileError, "capture name can't be splat: \"/:splat/\"") + expect { Mustermann::Grape.new('/:splat/') } + .to raise_error(Mustermann::CompileError, "capture name can't be splat: \"/:splat/\"") end example 'named captures' do - expect { Mustermann::Grape.new('/:captures/') }. - to raise_error(Mustermann::CompileError, "capture name can't be captures: \"/:captures/\"") + expect { Mustermann::Grape.new('/:captures/') } + .to raise_error(Mustermann::CompileError, "capture name can't be captures: \"/:captures/\"") end example 'with capital letter' do - expect { Mustermann::Grape.new('/:Foo/') }. - to raise_error(Mustermann::CompileError, "capture name must start with underscore or lower case letter: \"/:Foo/\"") + expect { Mustermann::Grape.new('/:Foo/') } + .to raise_error(Mustermann::CompileError, 'capture name must start with underscore or lower case letter: "/:Foo/"') end example 'with integer' do - expect { Mustermann::Grape.new('/:1a/') }. - to raise_error(Mustermann::CompileError, "capture name must start with underscore or lower case letter: \"/:1a/\"") + expect { Mustermann::Grape.new('/:1a/') } + .to raise_error(Mustermann::CompileError, 'capture name must start with underscore or lower case letter: "/:1a/"') end example 'same name twice' do - expect { Mustermann::Grape.new('/:foo(/:bar)?/:bar?') }. - to raise_error(Mustermann::CompileError, "can't use the same capture name twice: \"/:foo(/:bar)?/:bar?\"") + expect { Mustermann::Grape.new('/:foo(/:bar)?/:bar?') } + .to raise_error(Mustermann::CompileError, "can't use the same capture name twice: \"/:foo(/:bar)?/:bar?\"") end end context 'Regexp compatibility' do describe :=== do - example('non-matching') { Mustermann::Grape.new("/") .should_not be === '/foo' } - example('matching') { Mustermann::Grape.new("/:foo") .should be === '/foo' } + example('non-matching') { Mustermann::Grape.new('/') .should_not be === '/foo' } + example('matching') { Mustermann::Grape.new('/:foo') .should be === '/foo' } end describe :=~ do - example('non-matching') { Mustermann::Grape.new("/") .should_not be =~ '/foo' } - example('matching') { Mustermann::Grape.new("/:foo") .should be =~ '/foo' } + example('non-matching') { Mustermann::Grape.new('/') .should_not be =~ '/foo' } + example('matching') { Mustermann::Grape.new('/:foo') .should be =~ '/foo' } context 'String#=~' do - example('non-matching') { "/foo".should_not be =~ Mustermann::Grape.new("/") } - example('matching') { "/foo".should be =~ Mustermann::Grape.new("/:foo") } + example('non-matching') { '/foo'.should_not be =~ Mustermann::Grape.new('/') } + example('matching') { '/foo'.should be =~ Mustermann::Grape.new('/:foo') } end end @@ -722,31 +724,31 @@ context 'Proc compatibility' do describe :to_proc do - example { Mustermann::Grape.new("/").to_proc.should be_a(Proc) } - example('non-matching') { Mustermann::Grape.new("/") .to_proc.call('/foo').should be == false } - example('matching') { Mustermann::Grape.new("/:foo") .to_proc.call('/foo').should be == true } + example { Mustermann::Grape.new('/').to_proc.should be_a(Proc) } + example('non-matching') { Mustermann::Grape.new('/') .to_proc.call('/foo').should be == false } + example('matching') { Mustermann::Grape.new('/:foo') .to_proc.call('/foo').should be == true } end end - context "peeking" do - subject(:pattern) { Mustermann::Grape.new(":name") } + context 'peeking' do + subject(:pattern) { Mustermann::Grape.new(':name') } describe :peek_size do - example { pattern.peek_size("foo bar/blah") .should be == "foo bar".size } - example { pattern.peek_size("foo%20bar/blah") .should be == "foo%20bar".size } - example { pattern.peek_size("/foo bar") .should be_nil } + example { pattern.peek_size('foo bar/blah') .should be == 'foo bar'.size } + example { pattern.peek_size('foo%20bar/blah') .should be == 'foo%20bar'.size } + example { pattern.peek_size('/foo bar') .should be_nil } end describe :peek_match do - example { pattern.peek_match("foo bar/blah") .to_s .should be == "foo bar" } - example { pattern.peek_match("foo%20bar/blah") .to_s .should be == "foo%20bar" } - example { pattern.peek_match("/foo bar") .should be_nil } + example { pattern.peek_match('foo bar/blah') .to_s .should be == 'foo bar' } + example { pattern.peek_match('foo%20bar/blah') .to_s .should be == 'foo%20bar' } + example { pattern.peek_match('/foo bar') .should be_nil } end describe :peek_params do - example { pattern.peek_params("foo bar/blah") .should be == [{"name" => "foo bar"}, "foo bar".size] } - example { pattern.peek_params("foo%20bar/blah") .should be == [{"name" => "foo bar"}, "foo%20bar".size] } - example { pattern.peek_params("/foo bar") .should be_nil } + example { pattern.peek_params('foo bar/blah') .should be == [{ 'name' => 'foo bar' }, 'foo bar'.size] } + example { pattern.peek_params('foo%20bar/blah') .should be == [{ 'name' => 'foo bar' }, 'foo%20bar'.size] } + example { pattern.peek_params('/foo bar') .should be_nil } end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/spec_helper.rb new/spec/spec_helper.rb --- old/spec/spec_helper.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/spec/spec_helper.rb 2020-01-09 21:24:08.000000000 +0100 @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..')) + +require 'mustermann/grape'