shoes/shoes4 — pull request #220 by arnebrasseur (2013-03-24 17:52:22+00:00)
Title: Reset the GUI backend before each RSpec example.

This allows specs using the Mock backend, and specs for the SWT backend to be
run in the same rspec run. Currently when one simply types 'rspec' at the root
of the project, a number of specs fail because they assume a certain backend has
been set. But because the backend is effectively a global variable, and Shoes
only allows it to be set once, this causes problems.

The current way to solve this is to use a Rake task that invokes a separate
rspec run for each set of specs. This works, but I would argue that it breaks
the principle of least surprise. A newcomer checking out the project and running
`rspec` at the root of the project would get the impression that certain specs
are broken.

The proposed approach here is to have an extra 'destructive' method to set the
backend, Shoes.configuration.backend! (notice the bang), that sets the backend
to nil before trying to set it. This way a backend can be changed within one
process.

Before each example the backend is set with

let!(:backend) { Shoes.configure.backend! backend_name }

backend_name defaults to :mock, but can be set with let(:backend_name). In the
Swt specs, one can also 'tag' the example group like so:

describe Shoes::Swt::Star, :swt do