Let's say I have a gem called foo, with a file structure like so:

```
foo.gemspec
test_foo.rb
lib/foo.rb
lib/foo/file1.rb
lib/foo/file2.rb

```

The file `test_foo.rb` contains some code which I use to try out my gem. It accesses the gem's code with the following line:

```
require './lib/foo'

```

Then, `lib/foo.rb` acceses the other files required for the gem like so:

```
require './lib/foo/file1'
require './lib/foo/file2'

```

Since `test_foo.rb` is in the root of the gem directory, it is necessary to require the files in `lib/foo` with the complete path from the root directory.

This all works fine, and allows me to immediately play around with my gem by changing the code used in `test_foo.rb`. 

However, if I then want to build the gem, I then have to change my calls to `require`, like so:

```
require 'foo/file1'
require 'foo/file2'

```

instead of

```
require './lib/foo/file1'
require './lib/foo/file2'

```

Which is kind of tedious to do every time I want to build the gem.

So, I thought of another way of trying it out, which was to use `rake` to automate the build and install of the gem, something like this:

```
task :build do
    `gem build foo.gemspec`
    `gem uninstall foo`
    `gem install ./foo-0.0.0.gem`
end

```

and then when I made changes to my code, and wanted to try it out, just run `rake build`, and call `require 'foo'` in `test_foo.rb`.

But that is quite a slow process, and feels a bit like it defeats the point of ruby being a language where you don't have to build your code before trying it out.

So, my question is, what's the best workflow to use when actively developing a gem, and testing it out?