BernardK

BernardK

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

@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 :

% 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

--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 :

% 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
0 541 1

First Post!

noelrappin

noelrappin

Author of Modern Front-End Development for Rails

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

Popular Prag Prog topics Top

iPaul
page 37 ANTLRInputStream input = new ANTLRInputStream(is); as of ANTLR 4 .8 should be: CharStream stream = CharStreams.fromStream(i...
4 983 0
New
johnp
Running the examples in chapter 5 c under pytest 5.4.1 causes an AttributeError: ‘module’ object has no attribute ‘config’. In particula...
5 3532 1
New
belgoros
Following the steps described in Chapter 6 of the book, I’m stuck with running the migration as described on page 84: bundle exec sequel...
4 1149 1
New
conradwt
First, the code resources: Page 237: rumbl_umbrella/apps/rumbl/mix.exs Note: That this file is missing. Page 238: rumbl_umbrella/app...
1 1105 2
New
rmurray10127
Title: Intuitive Python: docker run… denied error (page 2) Attempted to run the docker command in both CLI and Powershell PS C:\Users\r...
9 1256 4
New
New
leba0495
Hello! Thanks for the great book. I was attempting the Trie (chap 17) exercises and for number 4 the solution provided for the autocorre...
0 1148 3
New
hazardco
On page 78 the following code appears: <%= link_to ‘Destroy’, product, class: ‘hover:underline’, method: :delete, data: { confirm...
1 1263 2
New
creminology
Skimming ahead, much of the following is explained in Chapter 3, but new readers (like me!) will hit a roadblock in Chapter 2 with their ...
6 1109 5
New
NaplesDave
I am using Android Studio Chipmunk | 2021.2.1 Patch 2 Build #AI-212.5712.43.2112.8815526, built on July 10, 2022 Runtime version: 11.0....
0 1389 2
New

Other popular topics Top

AstonJ
What chair do you have while working… and why? Is there a ‘best’ type of chair or working position for developers?
74 4668 41
New
siddhant3030
I’m thinking of buying a monitor that I can rotate to use as a vertical monitor? Also, I want to know if someone is using it for program...
51 4112 20
New
New
AstonJ
There’s a whole world of custom keycaps out there that I didn’t know existed! Check out all of our Keycaps threads here: https://forum....
15 7865 19
New
AstonJ
Thanks to @foxtrottwist’s and @Tomas’s posts in this thread: Poll: Which code editor do you use? I bought Onivim! :nerd_face: https://on...
88 5109 32
New
New
gagan7995
API 4 Path: /user/following/ Method: GET Description: Returns the list of all names of people whom the user follows Response [ { ...
7 2856 3
New
PragmaticBookshelf
Build efficient applications that exploit the unique benefits of a pure functional language, learning from an engineer who uses Haskell t...
15 4507 1
New
First poster: joeb
The File System Access API with Origin Private File System. WebKit supports new API that makes it possible for web apps to create, open,...
43 2807 21
New
PragmaticBookshelf
Author Spotlight: Sophie DeBenedetto @SophieDeBenedetto The days of the traditional request-response web application are long gone, b...
37 3003 14
New

Latest in PragProg

View all threads ❯