Skip to content

Commit

Permalink
Merge 5cd03d4 into 58cd7ce
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Nov 30, 2017
2 parents 58cd7ce + 5cd03d4 commit 9e2de73
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 3 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
-------------------------------------------------------------------------
Thu Nov 30 14:35:47 UTC 2017 - jreidinger@suse.com

- fix reading GRUB_TERMINAL (caused by fix for bsc#1068578)
- 0.6.5

-------------------------------------------------------------
Thu Nov 30 07:45:45 UTC 2017 - jreidinger@suse.com

- avoid crash if config file uses trailing comment (bsc#1068578)
Expand Down
2 changes: 1 addition & 1 deletion cfa_grub2.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = "cfa_grub2"
s.version = "0.6.4"
s.version = "0.6.5"
s.platform = Gem::Platform::RUBY
s.authors = ["Josef Reidinger"]
s.email = ["jreidinger@suse.cz"]
Expand Down
2 changes: 1 addition & 1 deletion lib/cfa/grub2/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def cryptodisk
end

def terminal
value = value_for("GRUB_ENABLE_CRYPTODISK")
value = value_for("GRUB_TERMINAL")
case value
when "", nil then nil
when "console" then :console
Expand Down
39 changes: 39 additions & 0 deletions spec/grub2_default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,45 @@
end
end

describe "#terminal" do
context "GRUB_TERMINAL is empty" do
let(:file_content) { "GRUB_TERMINAL=\"\"\n" }
it "returns nil" do
expect(config.terminal).to eq nil
end
end

context "GRUB_TERMINAL is console" do
let(:file_content) { "GRUB_TERMINAL=\"console\"\n" }
it "returns :console" do
expect(config.terminal).to eq :console
end
end

context "GRUB_TERMINAL is serial" do
let(:file_content) { "GRUB_TERMINAL=\"serial\"\n" }
it "returns :serial" do
expect(config.terminal).to eq :serial
end
end

context "GRUB_TERMINAL is gfxterm" do
let(:file_content) { "GRUB_TERMINAL=\"gfxterm\"\n" }
it "returns :gfxterm" do
expect(config.terminal).to eq :gfxterm
end
end

context "GRUB_TERMINAL is something else" do
let(:file_content) { "GRUB_TERMINAL=\"unknown\"\n" }
it "raises runtime error" do
expect { config.terminal }.to(
raise_error(RuntimeError, /unknown GRUB_TERMINAL/)
)
end
end
end

describe "#os_prober" do
let(:file_content) { "GRUB_DISABLE_OS_PROBER=true\n" }

Expand Down

0 comments on commit 9e2de73

Please sign in to comment.