Skip to content

Commit

Permalink
fixed "uninitialized constant Yast2::HwDetection::SCR" error (bnc#871…
Browse files Browse the repository at this point in the history
…783)

fixed testsuite

- 3.1.38
  • Loading branch information
lslezak committed Apr 8, 2014
1 parent c4881f2 commit c52cf5d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion library/system/src/lib/yast2/hw_detection.rb
Expand Up @@ -43,7 +43,7 @@ class HwDetection
# Return size of the system memory (in bytes)
# @return Fixnum,Bignum detected memory size
def self.memory
memory = SCR.Read(path(".probe.memory"))
memory = Yast::SCR.Read(Yast::Path.new(".probe.memory"))
log.debug("hwinfo memory: #{memory}")

raise "Memory detection failed" unless memory
Expand Down
3 changes: 2 additions & 1 deletion library/system/test/Makefile.am
@@ -1,5 +1,6 @@
TESTS = \
kernel_test.rb
kernel_test.rb \
hw_detection_test.rb

TEST_EXTENSIONS = .rb
RB_LOG_COMPILER = rspec
Expand Down
9 changes: 4 additions & 5 deletions library/system/test/hw_detection_test.rb
@@ -1,7 +1,6 @@
#! /usr/bin/rspec

require "yast"
include Yast

require_relative "../src/lib/yast2/hw_detection"

Expand Down Expand Up @@ -34,22 +33,22 @@

describe "#memory" do
it "returns detected memory size in bytes" do
SCR.should_receive(:Read).with(path(".probe.memory")).and_return([@memory])
Yast::SCR.should_receive(:Read).with(Yast::Path.new(".probe.memory")).and_return([@memory])
expect(Yast2::HwDetection.memory).to eq(@ramsize)
end

it "sums detected memory sizes" do
SCR.should_receive(:Read).with(path(".probe.memory")).and_return([@memory, @memory])
Yast::SCR.should_receive(:Read).with(Yast::Path.new(".probe.memory")).and_return([@memory, @memory])
expect(Yast2::HwDetection.memory).to eq(2*@ramsize)
end

it "ignores non-memory devices" do
SCR.should_receive(:Read).with(path(".probe.memory")).and_return([@memory, @non_memory])
Yast::SCR.should_receive(:Read).with(Yast::Path.new(".probe.memory")).and_return([@memory, @non_memory])
expect(Yast2::HwDetection.memory).to eq(@ramsize)
end

it "raises exception when detection fails" do
SCR.should_receive(:Read).with(path(".probe.memory")).and_return(nil)
Yast::SCR.should_receive(:Read).with(Yast::Path.new(".probe.memory")).and_return(nil)
expect{Yast2::HwDetection.memory}.to raise_error
end
end
Expand Down
7 changes: 7 additions & 0 deletions package/yast2.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Apr 8 11:40:15 UTC 2014 - lslezak@suse.cz

- fixed "uninitialized constant Yast2::HwDetection::SCR" error
(bnc#871783), fixed testsuite
- 3.1.38

-------------------------------------------------------------------
Wed Apr 2 09:18:51 UTC 2014 - jreidinger@suse.com

Expand Down

0 comments on commit c52cf5d

Please sign in to comment.