Sha256: 91cf5f63faf08c590a0447d2bdc93eae0d9e51c68c7a486dfd1360ad847ed825

Contents?: true

Size: 828 Bytes

Versions: 2

Compression:

Stored size: 828 Bytes

Contents

require File.expand_path('../test_helper.rb', File.dirname(__FILE__))

describe Gtk do
  describe "::init" do
    before do
      save_module :Gtk
      ::Object.const_set :Gtk, Module.new
      Gtk.class_eval do
        def self.init arr
          ["baz", "qux", "zonk"]
        end
      end
      mock(Gtk).setup_method("init") { }

      load 'gir_ffi-gtk/base.rb'
    end

    it "does not take any arguments" do
      assert_raises(ArgumentError) { Gtk.init 1, ["foo"] }
      assert_raises(ArgumentError) { Gtk.init ["foo"] }
      assert_nothing_raised { Gtk.init }
    end

    it "replaces ARGV with the tail of the result of the original init function" do
      ARGV.replace ["foo", "bar"]
      Gtk.init
      assert_equal ["qux", "zonk"], ARGV.to_a
    end

    after do
      restore_module :Gtk
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gir_ffi-gtk-0.7.0 test/gir_ffi-gtk/base_test.rb
gir_ffi-gtk-0.6.0 test/gir_ffi-gtk/base_test.rb