Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
53 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |