# Programming Ruby 3.2 (5th Edition): B1.0 page 269, cd gems/aaagmnr

**URL:** <https://forum.devtalk.com/t/programming-ruby-3-2-5th-edition-b1-0-page-269-cd-gems-aaagmnr/93097>\
**Category:** PragProg Customers\
**Tags:** suggestion, book-programming-ruby-3-2-5th-edition\
**Created:** [23 January 2023 07:46 UTC](https://forum.devtalk.com/t/programming-ruby-3-2-5th-edition-b1-0-page-269-cd-gems-aaagmnr/93097 "2023-01-23T07:46:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BernardK](https://forum.devtalk.com/letter_avatar_proxy/v4/letter/b/a5b964/32.png) [@BernardK](https://forum.devtalk.com/u/BernardK)\
**Post date:** [23 January 2023 07:46 UTC](https://forum.devtalk.com/t/programming-ruby-3-2-5th-edition-b1-0-page-269-cd-gems-aaagmnr/93097/1 "2023-01-23T07:46:20Z")

</div>

@noelrappin

page 269, running rspec

> These tests pass (after you update the .gemspec file):
> 
> $ rspec spec/aaagmnr/options\_spec.rb

It would be worth to explicitly mention to `cd` to `code/gems/aaagmnr` before running the test. As I work in `code`, I had an error :

```auto
% rspec -fd gems/aaagmnr/spec/aaagmnr/options_spec.rb

An error occurred while loading ./gems/aaagmnr/spec/aaagmnr/options_spec.rb.
Failure/Error:
    RSpec.describe Options do
...
NameError:
  uninitialized constant Aaagmnr::Options
...
0 examples, 0 failures, 1 error occurred outside of examples

```

I was able to solve it by adding

`require_relative '../../lib/aaagmnr'`

in `options_spec.rb`, but it’s not what you have planned.

The trick is that if we are in `code/gems/aaagmnr`, RSpec can silently load `.rspec`

```auto
--format documentation
--color
--require spec_helper

```

which requires `spec/spec_helper.rb`. Thanks to `require "aaagmnr"` in `spec_helper`, all the required files are loaded.  
Without this infrastructure in `code/gems/aaagmnr`, for example if I delete `.rspec` or `spec_helper.rb`, nothing works :

```auto
% rspec spec/aaagmnr/options_spec.rb
Resolving dependencies...

An error occurred while loading spec_helper.
Failure/Error: __send__ (method, file)

LoadError:
  cannot load such file -- spec_helper

```

---

<div class="post-metadata">

**Author:** ![noelrappin](https://forum.devtalk.com/user_avatar/forum.devtalk.com/noelrappin/32/481_2.png) [@noelrappin](https://forum.devtalk.com/u/noelrappin)\
**Post date:** [17 February 2023 17:04 UTC](https://forum.devtalk.com/t/programming-ruby-3-2-5th-edition-b1-0-page-269-cd-gems-aaagmnr/93097/2 "2023-02-17T17:04:49Z")

</div>

I think we’ll just note that you should run the specs from the root directory of the gem. Thanks!
