Skip to content

Commit

Permalink
Converted legacy testsuite/ to RSpec.
Browse files Browse the repository at this point in the history
  • Loading branch information
mvidner committed Jun 16, 2015
1 parent 2e37e02 commit f790db5
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 135 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ before_install:
# disable rvm, use system Ruby
- rvm reset
- wget https://raw.githubusercontent.com/yast/yast-devtools/master/travis-tools/travis_setup.sh
- sh ./travis_setup.sh -p "rake yast2-devtools yast2-testsuite yast2" -g "rspec:2.14.1 yast-rake gettext simplecov coveralls"
- sh ./travis_setup.sh -p "rake yast2-devtools yast2" -g "rspec:2.14.1 yast-rake gettext simplecov coveralls"
script:
- rake check:syntax
- rake check:pot
- COVERAGE=1 rake test:unit
- make -f Makefile.cvs
- make
- sudo make install
- make check
1 change: 0 additions & 1 deletion package/yast2-proxy.spec
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ License: GPL-2.0+
# should be required by devtools
BuildRequires: perl-XML-Writer pkgconfig rpm
BuildRequires: update-desktop-files
BuildRequires: yast2-testsuite
BuildRequires: yast2-devtools >= 3.1.10
BuildRequires: rubygem(rspec)

Expand Down
1 change: 1 addition & 0 deletions test/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
TESTS = \
read_test.rb \
test_proxy_return_code_test.rb \
write_test.rb

Expand Down
64 changes: 64 additions & 0 deletions test/read_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/env rspec
require_relative "test_helper"
require "yast"

Yast.import "Proxy"

describe "Yast::ProxyClass" do
subject do
Yast::Proxy
end

context "common Read-Export test" do
before do
expect(Yast::SCR).to receive(:Read).
with(path(".sysconfig.proxy.HTTP_PROXY")).
and_return "h"

expect(Yast::SCR).to receive(:Read).
with(path(".sysconfig.proxy.HTTPS_PROXY")).
and_return "hs"

expect(Yast::SCR).to receive(:Read).
with(path(".sysconfig.proxy.FTP_PROXY")).
and_return "f"

expect(Yast::SCR).to receive(:Read).
with(path(".sysconfig.proxy.NO_PROXY")).
and_return nil

expect(Yast::SCR).to receive(:Read).
with(path(".sysconfig.proxy.PROXY_ENABLED")).
and_return nil

expect(Yast::SCR).to receive(:Read).
with(path(".target.size"), "/root/.curlrc").
and_return 42

expect(Yast::SCR).to receive(:Read).
with(path(".root.curlrc.\"--proxy-user\"")).
and_return "user:pass"
end

describe "#Read" do
it "reads /etc/sysconfig/proxy and /root/.curlrc via SCR" do
expect(subject.Read).to be true
end
end

describe "#Export" do
it "returns an appropriate hash" do
subject.Read
expect(subject.Export).to eq({
"enabled" => true,
"ftp_proxy" => "f",
"http_proxy" => "h",
"https_proxy" => "hs",
"no_proxy" => "",
"proxy_password" => "pass",
"proxy_user" => "user"
})
end
end
end
end
21 changes: 0 additions & 21 deletions testsuite/Makefile.am

This file was deleted.

Empty file removed testsuite/tests/Proxy.err
Empty file.
14 changes: 0 additions & 14 deletions testsuite/tests/Proxy.out

This file was deleted.

97 changes: 0 additions & 97 deletions testsuite/tests/Proxy.rb

This file was deleted.

0 comments on commit f790db5

Please sign in to comment.