diff --git a/test/lib/release_notes_fetchers/rpm_test.rb b/test/lib/release_notes_fetchers/rpm_test.rb old mode 100644 new mode 100755 index ec30525b5..53fbbe16e --- a/test/lib/release_notes_fetchers/rpm_test.rb +++ b/test/lib/release_notes_fetchers/rpm_test.rb @@ -5,7 +5,7 @@ require "y2packager/product" describe Y2Packager::ReleaseNotesFetchers::Rpm do - subject(:reader) { described_class.new(product) } + subject(:fetcher) { described_class.new(product) } let(:product) { instance_double(Y2Packager::Product, name: "dummy") } let(:package) { Y2Packager::Package.new("release-notes-dummy", 2, "15.1") } @@ -42,13 +42,13 @@ it "cleans up temporary files" do dir = Dir.mktmpdir allow(Dir).to receive(:mktmpdir).and_return(dir) - reader.release_notes(prefs) + fetcher.release_notes(prefs) expect(File).to_not be_directory(dir) end context "when a full language code is given (xx_XX)" do it "returns product release notes for the given language" do - rn = reader.release_notes(prefs) + rn = fetcher.release_notes(prefs) expect(rn.content).to eq("Release Notes\n") expect(rn.lang).to eq("en") expect(rn.user_lang).to eq("en_US") @@ -58,7 +58,7 @@ let(:user_lang) { "de_DE" } it "returns product release notes for the short language code (xx)" do - rn = reader.release_notes(prefs) + rn = fetcher.release_notes(prefs) expect(rn.content).to eq("Versionshinweise\n") expect(rn.lang).to eq("de") expect(rn.user_lang).to eq("de_DE") @@ -70,7 +70,7 @@ let(:format) { :html } it "returns product release notes in the given format" do - rn = reader.release_notes(prefs) + rn = fetcher.release_notes(prefs) expect(rn.content).to eq("

Release Notes

\n") expect(rn.format).to eq(:html) end @@ -80,7 +80,7 @@ let(:format) { :html } it "returns the English version" do - rn = reader.release_notes(prefs) + rn = fetcher.release_notes(prefs) expect(rn.content).to eq("

Release Notes

\n") expect(rn.format).to eq(:html) end @@ -91,7 +91,7 @@ let(:provides) { [] } it "returns nil" do - expect(reader.release_notes(prefs)).to be_nil + expect(fetcher.release_notes(prefs)).to be_nil end end @@ -104,7 +104,7 @@ end it "selects the latest one" do - rn = reader.release_notes(prefs) + rn = fetcher.release_notes(prefs) expect(rn.version).to eq("15.1") end end @@ -115,23 +115,23 @@ end it "ignores the package" do - expect(reader.release_notes(prefs)).to be_nil + expect(fetcher.release_notes(prefs)).to be_nil end end end describe "#latest_version" do it "returns latest version from release notes package" do - expect(reader.latest_version).to eq(package.version) + expect(fetcher.latest_version).to eq(package.version) end context "when no release notes package was found" do before do - allow(reader).to receive(:release_notes_package).and_return(nil) + allow(fetcher).to receive(:release_notes_package).and_return(nil) end it "returns :none" do - expect(reader.latest_version).to eq(:none) + expect(fetcher.latest_version).to eq(:none) end end end diff --git a/test/lib/release_notes_fetchers/url_test.rb b/test/lib/release_notes_fetchers/url_test.rb old mode 100644 new mode 100755 index 3545a89dc..07c467b4f --- a/test/lib/release_notes_fetchers/url_test.rb +++ b/test/lib/release_notes_fetchers/url_test.rb @@ -5,7 +5,7 @@ require "y2packager/product" describe Y2Packager::ReleaseNotesFetchers::Url do - subject(:reader) { described_class.new(product) } + subject(:fetcher) { described_class.new(product) } let(:product) { instance_double(Y2Packager::Product, name: "dummy") } let(:relnotes_url) { "http://doc.opensuse.org/openSUSE/release-notes-openSUSE.rpm" } @@ -54,7 +54,7 @@ expect(Yast::SCR).to receive(:Execute).with(Yast::Path.new(".target.bash"), cmd) .and_return(0) expect(File).to receive(:read).with(/relnotes/).and_return(content) - rn = reader.release_notes(prefs) + rn = fetcher.release_notes(prefs) expect(rn.product_name).to eq("dummy") expect(rn.content).to eq(content) @@ -69,7 +69,7 @@ "> '/var/log/YaST2/curl_log' 2>&1" expect(Yast::SCR).to receive(:Execute).with(Yast::Path.new(".target.bash"), cmd) - reader.release_notes(prefs) + fetcher.release_notes(prefs) end context "when release notes are not found for the given language" do @@ -83,7 +83,7 @@ expect(Yast::SCR).to receive(:Execute) .with(Yast::Path.new(".target.bash"), /RELEASE-NOTES.de.txt/) .and_return(0) - reader.release_notes(prefs) + fetcher.release_notes(prefs) end context "and are not found for the generic language" do @@ -97,7 +97,7 @@ expect(Yast::SCR).to receive(:Execute) .with(Yast::Path.new(".target.bash"), /RELEASE-NOTES.en.txt/) .and_return(0) - reader.release_notes(prefs) + fetcher.release_notes(prefs) end end @@ -109,7 +109,7 @@ expect(Yast::SCR).to receive(:Execute) .with(Yast::Path.new(".target.bash"), /RELEASE-NOTES.en.txt/) .once.and_return(1) - reader.release_notes(prefs) + fetcher.release_notes(prefs) end end end @@ -132,7 +132,7 @@ expect(Yast::SCR).to receive(:Execute) .with(Yast::Path.new(".target.bash"), /RELEASE-NOTES.de_DE.txt/) .and_return(0) - reader.release_notes(prefs) + fetcher.release_notes(prefs) end end @@ -144,7 +144,7 @@ it "does not try to download release notes" do expect(Yast::SCR).to_not receive(:Execute) .with(Yast::Path.new(".target.bash"), /RELEASE-NOTES.de_DE.txt/) - reader.release_notes(prefs) + fetcher.release_notes(prefs) end end end @@ -154,7 +154,7 @@ it "blacklists the URL" do expect(described_class).to receive(:add_to_blacklist).with(relnotes_url) - reader.release_notes(prefs) + fetcher.release_notes(prefs) end end @@ -163,7 +163,7 @@ it "disables downloading release notes via relnotes_url" do expect(described_class).to receive(:disable!).and_call_original - reader.release_notes(prefs) + fetcher.release_notes(prefs) end end @@ -171,7 +171,7 @@ let(:relnotes_url) { "http" } it "returns nil" do - expect(reader.release_notes(prefs)).to be_nil + expect(fetcher.release_notes(prefs)).to be_nil end end @@ -179,7 +179,7 @@ let(:relnotes_url) { nil } it "returns nil" do - expect(reader.release_notes(prefs)).to be_nil + expect(fetcher.release_notes(prefs)).to be_nil end end @@ -187,7 +187,7 @@ let(:relnotes_url) { "" } it "returns nil" do - expect(reader.release_notes(prefs)).to be_nil + expect(fetcher.release_notes(prefs)).to be_nil end end @@ -197,13 +197,13 @@ end it "returns nil" do - expect(reader.release_notes(prefs)).to be_nil + expect(fetcher.release_notes(prefs)).to be_nil end it "does not tries to download anything" do expect(Yast::SCR).to_not receive(:Execute) .with(Yast::Path.new(".target.bash"), /curl/) - reader.release_notes(prefs) + fetcher.release_notes(prefs) end end @@ -213,13 +213,13 @@ end it "returns nil" do - expect(reader.release_notes(prefs)).to be_nil + expect(fetcher.release_notes(prefs)).to be_nil end it "does not tries to download anything" do expect(Yast::SCR).to_not receive(:Execute) .with(Yast::Path.new(".target.bash"), /curl/) - reader.release_notes(prefs) + fetcher.release_notes(prefs) end end @@ -248,7 +248,7 @@ expect(cmd).to include("--proxy http://proxy.example.com") end - reader.release_notes(prefs) + fetcher.release_notes(prefs) end end @@ -261,7 +261,7 @@ expect(cmd).to include("--proxy http://proxy.example.com --proxy-user 'baggins:thief'") end - reader.release_notes(prefs) + fetcher.release_notes(prefs) end end end @@ -269,7 +269,7 @@ describe "#latest_version" do it "returns :latest" do - expect(reader.latest_version).to eq(:latest) + expect(fetcher.latest_version).to eq(:latest) end end end