Sha256: 277437cf09aec8692f0f1aa5a2a6dcda57e0dab26ce416419d4369d591e75585

Contents?: true

Size: 689 Bytes

Versions: 4

Compression:

Stored size: 689 Bytes

Contents

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

require 'ffi-gobject/ruby_style'

describe GObject::RubyStyle do
  class RubyStyleTest
    include GObject::RubyStyle
    def get_x
      @x
    end
    def set_x(val)
      @x = val
    end
  end

  subject { RubyStyleTest.new }

  it 'reads x by calling get_x' do
    subject.set_x(1)
    assert_equal 1, subject.x
  end

  it 'writes x by calling set_x' do
    subject.x = 2
    assert_equal 2, subject.x
  end

  it 'delegates signal_connect to GObject' do
    mock(GObject).signal_connect(subject, 'some-event')
    subject.signal_connect('some-event') do
      nothing
    end

    RR.verify
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gir_ffi-0.4.0 test/ffi-gobject/ruby_style_test.rb
gir_ffi-0.3.2 test/ffi-gobject/ruby_style_test.rb
gir_ffi-0.3.1 test/ffi-gobject/ruby_style_test.rb
gir_ffi-0.3.0 test/ffi-gobject/ruby_style_test.rb