Sha256: ee9c1b1a2abda2673a6ebee399167f69501800bfbdfa9cef450369bb00e31f25

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 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::ExportDialog do
  let(:parent) { Gtk::Window.new :toplevel }
  let(:library) { Alexandria::Library.new "Bar Library" }
  let(:sort_order) { Alexandria::LibrarySortOrder::Unsorted.new }

  it "works" do
    described_class.new parent, library, sort_order
  end

  describe "#perform" do
    let(:export_dialog) { described_class.new parent, library, sort_order }
    let(:chooser) { export_dialog.dialog }

    it "works when response is cancel" do
      allow(chooser).to receive(:run).and_return(Gtk::ResponseType::CANCEL)
      export_dialog.perform
    end

    it "works when response is OK" do
      dir = Dir.mktmpdir
      allow(chooser).to receive(:run).and_return(Gtk::ResponseType::OK)
      allow(chooser).to receive(:filename).and_return File.join(dir, "export")
      export_dialog.perform
    ensure
      FileUtils.remove_entry dir
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
alexandria-book-collection-manager-0.7.9 spec/alexandria/ui/export_dialog_spec.rb
alexandria-book-collection-manager-0.7.8 spec/alexandria/ui/export_dialog_spec.rb
alexandria-book-collection-manager-0.7.7 spec/alexandria/ui/export_dialog_spec.rb