Sha256: 5f19d15939c9319dc221c4d7a515f7fb713a54c559e19693fc024eb0cb98d9f6
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::ImportDialog do let(:parent) { Gtk::Window.new :toplevel } it "can be instantiated" do expect { described_class.new parent }.not_to raise_error end it "handles a selection change" do importdialog = described_class.new parent expect { importdialog.dialog.signal_emit "selection_changed" }.not_to raise_error end describe "#acquire" do let(:import_dialog) { described_class.new parent } let(:chooser) { import_dialog.dialog } before do allow(chooser).to receive(:filename).and_return("spec/data/isbns.txt") allow(Alexandria::BookProviders).to receive(:isbn_search) .and_raise Alexandria::BookProviders::SearchEmptyError allow(Alexandria::BookProviders).to receive(:isbn_search).with("0595371086") .and_return(an_artist_of_the_floating_world) end it "works when response is cancel" do allow(chooser).to receive(:run).and_return(Gtk::ResponseType::CANCEL) expect { import_dialog.acquire { nil } }.not_to raise_error end it "works when response is OK" do allow(chooser).to receive(:run).and_return(Gtk::ResponseType::OK) result = nil import_dialog.acquire { |*args| result = args } expect(result.first.to_a).to eq [an_artist_of_the_floating_world] 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/import_dialog_spec.rb |