Skip to content

Commit

Permalink
Merge 394a2ce into 383d676
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Sep 12, 2017
2 parents 383d676 + 394a2ce commit 7349c67
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 87 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -12,7 +12,9 @@ config.status
config.sub
configure
configure.ac
coverage/
depcomp
doc/
install-sh
*.pot
libtool
Expand All @@ -29,3 +31,4 @@ tmp.*
*.log
*.ybc
test-driver
.yardoc/
4 changes: 3 additions & 1 deletion Dockerfile
@@ -1,3 +1,5 @@
FROM yastdevel/ruby
RUN RUBY_VERSION=`rpm --eval '%{rb_default_ruby_abi}'` && \
zypper --gpg-auto-import-keys --non-interactive in --no-recommends \
"rubygem($RUBY_VERSION:ruby-dbus)"
COPY . /usr/src/app

1 change: 1 addition & 0 deletions README.md
Expand Up @@ -2,4 +2,5 @@

[![Travis Build](https://travis-ci.org/yast/yast-snapper.svg?branch=master)](https://travis-ci.org/yast/yast-snapper)
[![Jenkins Build](http://img.shields.io/jenkins/s/https/ci.opensuse.org/yast-snapper-master.svg)](https://ci.opensuse.org/view/Yast/job/yast-snapper-master/)
[![Coverage Status](https://img.shields.io/coveralls/yast/yast-snapper/master.svg)](https://coveralls.io/github/yast/yast-snapper?branch=master)

6 changes: 6 additions & 0 deletions package/yast2-snapper.changes
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Sep 12 07:12:53 UTC 2017 - igonzalezsosa@suse.com

- Add missing dependency on ruby-dbus library (bsc#1058127)
- 4.0.0

-------------------------------------------------------------------
Thu Jan 5 14:15:57 UTC 2017 - jreidinger@suse.com

Expand Down
22 changes: 11 additions & 11 deletions package/yast2-snapper.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-snapper
Version: 3.2.0
Version: 4.0.0
Release: 0
Group: System/YaST

Expand All @@ -29,17 +29,17 @@ Source0: %{name}-%{version}.tar.bz2

License: GPL-2.0

BuildRequires: doxygen
BuildRequires: update-desktop-files
BuildRequires: yast2
BuildRequires: yast2-devtools >= 3.1.10
BuildRequires: rubygem(rspec)
BuildRequires: rubygem(ruby-dbus)

Requires: yast2 >= 2.21.22
BuildRequires: doxygen
BuildRequires: update-desktop-files
BuildRequires: yast2
BuildRequires: yast2-devtools >= 3.1.10
BuildRequires: rubygem(%{rb_default_ruby_abi}:rspec)
BuildRequires: rubygem(%{rb_default_ruby_abi}:ruby-dbus)
Requires: snapper
Requires: yast2 >= 2.21.22
Requires: yast2-ruby-bindings >= 1.0.0
Requires: snapper
Supplements: packageand(snapper:yast2)
Requires: rubygem(%{rb_default_ruby_abi}:ruby-dbus)
Supplements: packageand(snapper:yast2)

Summary: YaST - file system snapshots review
Url: http://github.com/yast/yast-snapper/
Expand Down
18 changes: 1 addition & 17 deletions test/snapper_dbus_escape_test.rb
@@ -1,42 +1,26 @@
#!/usr/bin/env rspec
# coding: utf-8

ENV["Y2DIR"] = File.expand_path("../../src", __FILE__)

require "yast"
require_relative "test_helper"

Yast.import "Snapper"


describe "SnapperDbus#escape" do


it "call with nothing special" do

expect(Yast::SnapperDbus.send(:escape, "hello")).to eq("hello")

end


it "call with UTF-8" do

expect(Yast::SnapperDbus.send(:escape, "schön")).to eq("sch\\xc3\\xb6n".force_encoding(Encoding::ASCII_8BIT))

end


it "call with slash" do

expect(Yast::SnapperDbus.send(:escape, "\\")).to eq("\\\\")

end


it "call with a hash" do

expect(Yast::SnapperDbus.send(:escape, { "schön" => "hier" })).to eq({ "sch\\xc3\\xb6n".force_encoding(Encoding::ASCII_8BIT) => "hier" })

end


end
20 changes: 1 addition & 19 deletions test/snapper_dbus_unescape_test.rb
@@ -1,43 +1,25 @@
#!/usr/bin/env rspec
# coding: utf-8

ENV["Y2DIR"] = File.expand_path("../../src", __FILE__)

require "yast"
require_relative "test_helper"

Yast.import "Snapper"


describe "SnapperDbus#unescape" do


it "call with nothing special" do

expect(Yast::SnapperDbus.send(:unescape, "hello")).to eq("hello")
expect(Yast::SnapperDbus.send(:unescape, "world").encoding).to eq(Encoding::ASCII_8BIT)

end


it "call with escaped UTF-8" do

expect(Yast::SnapperDbus.send(:unescape, "sch\\xc3\\xb6n")).to eq("schön".force_encoding(Encoding::ASCII_8BIT))

end


it "call with slash" do

expect(Yast::SnapperDbus.send(:unescape, "\\\\")).to eq("\\")

end


it "call with a hash" do

expect(Yast::SnapperDbus.send(:unescape, { "sch\\xc3\\xb6n" => "hier" })).to eq({ "schön".force_encoding(Encoding::ASCII_8BIT) => "hier" })

end


end
20 changes: 1 addition & 19 deletions test/snapper_string_to_userdata_test.rb
@@ -1,41 +1,23 @@
#!/usr/bin/env rspec

ENV["Y2DIR"] = File.expand_path("../../src", __FILE__)

require "yast"
require_relative "test_helper"

Yast.import "Snapper"


describe "Snapper#string_to_userdata" do


it "call with empty string" do

expect(Yast::Snapper.string_to_userdata("")).to eq({ })

end


it "call with simple string" do

expect(Yast::Snapper.string_to_userdata("hello=world")).to eq({ "hello" => "world" })

end


it "call with complex string" do

expect(Yast::Snapper.string_to_userdata("a=1,b=2")).to eq({ "a" => "1", "b" => "2" })

end


it "call with complex string and space after comma" do

expect(Yast::Snapper.string_to_userdata("a=1, b=2")).to eq({ "a" => "1", "b" => "2" })

end


end
5 changes: 1 addition & 4 deletions test/snapper_tree_test.rb
@@ -1,13 +1,10 @@
#!/usr/bin/env rspec

ENV["Y2DIR"] = File.expand_path("../../src", __FILE__)

require "yast"
require_relative "test_helper"

Yast.import "Snapper"

describe Yast::SnapperClass::Tree do

subject { Yast::SnapperClass::Tree.new("", nil) }

describe "#each" do
Expand Down
17 changes: 1 addition & 16 deletions test/snapper_userdata_to_string_test.rb
@@ -1,34 +1,19 @@
#!/usr/bin/env rspec

ENV["Y2DIR"] = File.expand_path("../../src", __FILE__)

require "yast"
require_relative "test_helper"

Yast.import "Snapper"


describe "Snapper#userdata_to_string" do


it "call with empty userdata" do

expect(Yast::Snapper.userdata_to_string({ })).to eq("")

end


it "call with simple userdata" do

expect(Yast::Snapper.userdata_to_string({ "hello" => "world" })).to eq("hello=world")

end


it "call with complex userdata" do

expect(Yast::Snapper.userdata_to_string({ "a" => "1", "b" => "2" })).to eq("a=1, b=2")

end


end
24 changes: 24 additions & 0 deletions test/test_helper.rb
@@ -0,0 +1,24 @@
ENV["Y2DIR"] = File.expand_path("../../src", __FILE__)

require "yast"

if ENV["COVERAGE"]
require "simplecov"
SimpleCov.start do
# Don't measure coverage of the tests themselves.
add_filter "/test/"
end

# track all ruby files under src
src_location = File.expand_path("../../src", __FILE__)
SimpleCov.track_files("#{src_location}/**/*.rb")

# use coveralls for on-line code coverage reporting at Travis CI
if ENV["TRAVIS"]
require "coveralls"
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
end
end

0 comments on commit 7349c67

Please sign in to comment.