Sha256: fb66c67e7232b59910267e6f33cd05f049a978f842bb7630b3db5b0754ef6a44

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

require "shoes/swt"
require "spec_helper"

Shoes.load_backend("swt").initialize_backend

RSpec.configure do |config|
  config.before(:each) do
    allow(Swt).to receive(:event_loop)
    allow_any_instance_of(Shoes::Swt::App).to receive_messages(flush: true)
    allow_any_instance_of(Swt::Widgets::Shell).to receive(:open)
    allow_any_instance_of(Swt::Widgets::MessageBox).to receive(:open)
    # stubbed as otherwise all sorts of callbacks are added during certain specs,
    # which then fail because some doubles are not made for the methods called
    allow(Shoes::Swt::RedrawingAspect).to receive_messages new: true
  end
end

# as we do not create real apps most of the time there are no redraws and we
# we don't really want that during test execution either way as it adds stuff to
# methods that might break
def with_redraws(&blk)
  allow(Shoes::Swt::RedrawingAspect).to receive(:new).and_call_original
  aspect = Shoes::Swt::RedrawingAspect.new swt_app, double
  begin
    yield
  ensure
    aspect.remove_redraws
  end
end

shared_examples = File.expand_path('../shared_examples/**/*.rb', __FILE__)
Dir[shared_examples].each { |f| require f }

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shoes-swt-4.0.0.pre4 spec/shoes/swt/spec_helper.rb