Hello community, here is the log from the commit of package yast2-ruby-bindings for openSUSE:Factory checked in at 2015-04-06 00:24:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-ruby-bindings (Old) and /work/SRC/openSUSE:Factory/.yast2-ruby-bindings.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-ruby-bindings" Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-ruby-bindings/yast2-ruby-bindings.changes 2015-03-16 09:40:49.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.yast2-ruby-bindings.new/yast2-ruby-bindings.changes 2015-04-06 00:24:22.000000000 +0200 @@ -1,0 +2,6 @@ +Wed Apr 1 15:38:04 UTC 2015 - an...@suse.com + +- Added new RSpec argument matcher: path_matching +- 3.1.31 + +------------------------------------------------------------------- Old: ---- yast2-ruby-bindings-3.1.30.tar.bz2 New: ---- yast2-ruby-bindings-3.1.31.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-ruby-bindings.spec ++++++ --- /var/tmp/diff_new_pack.pLUwtg/_old 2015-04-06 00:24:23.000000000 +0200 +++ /var/tmp/diff_new_pack.pLUwtg/_new 2015-04-06 00:24:23.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-ruby-bindings -Version: 3.1.30 +Version: 3.1.31 Release: 0 Url: https://github.com/yast/yast-ruby-bindings BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ yast2-ruby-bindings-3.1.30.tar.bz2 -> yast2-ruby-bindings-3.1.31.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-3.1.30/package/yast2-ruby-bindings.changes new/yast2-ruby-bindings-3.1.31/package/yast2-ruby-bindings.changes --- old/yast2-ruby-bindings-3.1.30/package/yast2-ruby-bindings.changes 2015-03-05 18:25:14.000000000 +0100 +++ new/yast2-ruby-bindings-3.1.31/package/yast2-ruby-bindings.changes 2015-04-02 12:55:15.000000000 +0200 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Wed Apr 1 15:38:04 UTC 2015 - an...@suse.com + +- Added new RSpec argument matcher: path_matching +- 3.1.31 + +------------------------------------------------------------------- Thu Mar 5 15:15:07 UTC 2015 - mvid...@suse.com - Fix building with yast2-core-3.1.16: use C++11 like core does diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-3.1.30/package/yast2-ruby-bindings.spec new/yast2-ruby-bindings-3.1.31/package/yast2-ruby-bindings.spec --- old/yast2-ruby-bindings-3.1.30/package/yast2-ruby-bindings.spec 2015-03-05 18:25:14.000000000 +0100 +++ new/yast2-ruby-bindings-3.1.31/package/yast2-ruby-bindings.spec 2015-04-02 12:55:15.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-ruby-bindings -Version: 3.1.30 +Version: 3.1.31 Url: https://github.com/yast/yast-ruby-bindings Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-3.1.30/src/ruby/yast/rspec/matchers.rb new/yast2-ruby-bindings-3.1.31/src/ruby/yast/rspec/matchers.rb --- old/yast2-ruby-bindings-3.1.30/src/ruby/yast/rspec/matchers.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-ruby-bindings-3.1.31/src/ruby/yast/rspec/matchers.rb 2015-04-02 12:55:15.000000000 +0200 @@ -0,0 +1,40 @@ +require "rspec" +require "yast" + +module Yast + module RSpec + # RSpec extension to add YaST-specific matchers + module Matchers + # Matches arguments of type YaST::Path whose string representation matches + # the provided regular expression + # + # @example + # expect(Yast::SCR).to receive(:Read).with(path_matching(/^\.sysconfig\.nfs/)) + def path_matching(match) + PathMatchingMatcher.new(match) + end + + # @private + class PathMatchingMatcher + def initialize(expected) + @expected = Regexp.new(expected) + end + + # RSpec 3 uses === while RSpec 2 uses == + # Thus, implementing just == should work with both + def ==(other) + return false unless other.is_a?(Yast::Path) + other.to_s =~ @expected ? true : false + end + + def description + "path_matching(#{@expected.inspect})" + end + + def inspect + description + end + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-3.1.30/src/ruby/yast/rspec.rb new/yast2-ruby-bindings-3.1.31/src/ruby/yast/rspec.rb --- old/yast2-ruby-bindings-3.1.30/src/ruby/yast/rspec.rb 2015-03-05 18:25:14.000000000 +0100 +++ new/yast2-ruby-bindings-3.1.31/src/ruby/yast/rspec.rb 2015-04-02 12:55:15.000000000 +0200 @@ -1,7 +1,9 @@ require 'yast/rspec/scr' require 'yast/rspec/shortcuts' +require 'yast/rspec/matchers' RSpec.configure do |c| c.include Yast::RSpec::Shortcuts c.include Yast::RSpec::SCR + c.include Yast::RSpec::Matchers end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-3.1.30/tests/ruby/rspec_matchers_spec.rb new/yast2-ruby-bindings-3.1.31/tests/ruby/rspec_matchers_spec.rb --- old/yast2-ruby-bindings-3.1.30/tests/ruby/rspec_matchers_spec.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-ruby-bindings-3.1.31/tests/ruby/rspec_matchers_spec.rb 2015-04-02 12:55:15.000000000 +0200 @@ -0,0 +1,38 @@ +#!/usr/bin/env rspec + +require_relative "test_helper" + +require "yast/rspec" + +describe Yast::RSpec::Matchers do + describe "#path_matching" do + it "matches if the path is identical" do + path = Yast::Path.new(".etc") + expect(path).to receive(:+).with(path_matching('\.fstab')) + .and_return "success" + + expect(path + path(".fstab")).to eq "success" + end + + it "does not match if the argument is not a YaST Path" do + path = Yast::Path.new(".etc") + expect(path).to_not receive(:+).with(path_matching('\.fstab')) + + path + ".fstab" + end + + it "matches a simple regular expression" do + expect(Yast::SCR).to receive(:Read) + .with(path_matching(/target.*ir$/)).and_return "success" + + expect(Yast::SCR.Read(path(".target.dir"))).to eq "success" + end + + it "does not match if the regexp does not match" do + expect(Yast::SCR).to_not receive(:Read) + .with(path_matching(/target.*ir$/)) + + Yast::SCR.Read(path(".etc")) + end + end +end