Sha256: 2f36767550007d585e6ad9a60a47691e9e7a147ef0b831fa9128c7b6c34b4377
Contents?: true
Size: 1.45 KB
Versions: 1
Compression:
Stored size: 1.45 KB
Contents
# frozen_string_literal: true # This file is part of Alexandria. # # See the file README.md for authorship and licensing information. require_relative "../../spec_helper" describe Alexandria::UI::NewBookDialogManual do let(:parent) { Gtk::Window.new :toplevel } let(:library) do store = Alexandria::LibraryCollection.instance.library_store store.load_library("Bar Library") end it "works" do expect { described_class.new parent, library }.not_to raise_error end describe "#on_change_cover" do let(:dialog) { described_class.new parent, library } let(:filechooser) { instance_double(Gtk::FileChooserDialog).as_null_object } before do allow(Gtk::FileChooserDialog).to receive(:new).and_return(filechooser) allow(filechooser).to receive(:filename) .and_return File.join(__dir__, "../../fixtures/cover.jpg") end it "works when response is accept" do allow(filechooser) .to receive(:run).and_return(Gtk::ResponseType::ACCEPT) expect { dialog.on_change_cover }.not_to raise_error end it "works when response is reject" do allow(filechooser) .to receive(:run).and_return(Gtk::ResponseType::REJECT) expect { dialog.on_change_cover }.not_to raise_error end it "works when response is cancel" do allow(filechooser) .to receive(:run).and_return(Gtk::ResponseType::CANCEL) expect { dialog.on_change_cover }.not_to raise_error end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
alexandria-book-collection-manager-0.7.10 | spec/alexandria/ui/new_book_dialog_manual_spec.rb |