Sha256: a572ff371d35e0229a2a6faa11580aca89f5a18fae2f8152af34836bfaf32be2

Contents?: true

Size: 822 Bytes

Versions: 5

Compression:

Stored size: 822 Bytes

Contents

require File.expand_path('gir_ffi_test_helper.rb', File.dirname(__FILE__))

describe "Gtk's overrides" 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
    stub(Gtk)._setup_method { }

    load 'ffi-gtk/base.rb'
  end

  context "The .init function" do
    should "not take any arguments" do
      assert_raises(ArgumentError) { Gtk.init 1, ["foo"] }
      assert_raises(ArgumentError) { Gtk.init ["foo"] }
      assert_nothing_raised { Gtk.init }
    end

    should "replace 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
  end

  after do
    restore_module :Gtk
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gir_ffi-0.2.3 test/gtk_overrides_test.rb
gir_ffi-0.2.2 test/gtk_overrides_test.rb
gir_ffi-0.2.1 test/gtk_overrides_test.rb
gir_ffi-0.2.0 test/gtk_overrides_test.rb
gir_ffi-0.1.0 test/gtk_overrides_test.rb