Skip to content

Commit

Permalink
update test to simplified slide show
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Jan 12, 2022
1 parent e129794 commit ad88b11
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 74 deletions.
1 change: 1 addition & 0 deletions src/modules/PackageSlideShow.rb
Expand Up @@ -31,6 +31,7 @@ def main

@total_downloaded = 0
@total_installed = 0
@total_pkgs_to_install = 0

# package list (only used in installed system)
@installed_packages_list = []
Expand Down
74 changes: 0 additions & 74 deletions test/package_slide_show_test.rb
Expand Up @@ -17,61 +17,6 @@
end
end

describe ".SwitchToSecondsIfNecessary" do
before do
# set internal variable if showing time or not
package_slide_show.instance_variable_set(:@unit_is_seconds, show_time)
end

context "remaining time is already shown" do
let(:show_time) { true }

it "returns false" do
expect(package_slide_show.SwitchToSecondsIfNecessary).to eq false
end
end

context "remaining time is not yet shown" do
let(:show_time) { false }

context "initial delay does not pass yet" do
before do
allow(Yast2::SystemTime).to receive(:uptime).and_return(5)
allow(Yast::SlideShow).to receive(:start_time).and_return(3)
allow(Yast::SlideShow).to receive(:initial_recalc_delay).and_return(3)
end

it "returns false" do
expect(package_slide_show.SwitchToSecondsIfNecessary).to eq false
end
end

context "initial delay already pass" do
before do
allow(Yast2::SystemTime).to receive(:uptime).and_return(10)
allow(Yast::SlideShow).to receive(:start_time).and_return(3)
allow(Yast::SlideShow).to receive(:initial_recalc_delay).and_return(3)
end

it "returns false" do
expect(package_slide_show.SwitchToSecondsIfNecessary).to eq true
end

it "sets to display remaining time" do
package_slide_show.SwitchToSecondsIfNecessary

expect(package_slide_show.show_remaining_time?).to eq true
end

it "recalculates remaining time" do
expect(package_slide_show).to receive(:RecalcRemainingTimes)

package_slide_show.SwitchToSecondsIfNecessary
end
end
end
end

describe ".SlideDisplayDone" do
context "when deleting package" do
it "increases removed counter in summary" do
Expand Down Expand Up @@ -133,23 +78,4 @@
end
end
end

describe ".FormatTimeShowOverflow" do
it "formats time" do
time = 1 * 3600 + 14 * 60 + 30
expect(package_slide_show.FormatTimeShowOverflow(time)).to eq "1:14:30"
end

it "shows >MAX_TIME if time exceed MAX_TIME" do
time = 14 * 60 + 30 + Yast::PackageSlideShowClass::MAX_TIME
expect(package_slide_show.FormatTimeShowOverflow(time)).to eq ">2:00:00"
end
end

describe ".CdStatisticsTableItems" do
it "returns array of table items" do
package_slide_show.main # to reset counter
expect(package_slide_show.CdStatisticsTableItems).to be_a(::Array)
end
end
end

0 comments on commit ad88b11

Please sign in to comment.