KCNyu / db_tutorial_cpp

Writing a sqlite clone from scratch in C++
MIT License
130 stars 23 forks source link

Seek for help #1

Closed 955xiaoSu closed 1 year ago

955xiaoSu commented 2 years ago

It's my first time to use ruby and rspec. So I always failed in runing 'rspec spec db_test.rb', this process will be killed as for outing of memory. Does ruby need some configuration before to make it run normally?

KCNyu commented 2 years ago

If it's possible, could you please show me your specific error message? And also the version of ruby and respec (ruby -v && rspec -v) you are using?

955xiaoSu commented 2 years ago

If it's possible, could you please show me your specific error message? And also the version of ruby and respec (ruby -v && rspec -v) you are using?

After some attemption, my error message became another one like this: 屏幕截图 2022-09-16 124903 Search it on google, I guess that meybe ruby require some prefix configuration like file path and so on. Anyway it still make me confuszed. My ruby verision is 2.7.4p191 and rspec version is 3.9.

KCNyu commented 2 years ago

Maybe you can try to just use rspec db_test.rb or rspec ./db_test.rb.

955xiaoSu commented 2 years ago

Maybe you can try to just use rspec db_test.rb or rspec ./db_test.rb.

Unfortunately, I still failed this time with error An error occurred while loading spec_helper. Failure / Error: return gem_original_require(path). Accoriding to an answer in StackOverFlow, I enter rspec --init command and then I get a subfolder spec. Then I copy the file db_test.rb to spec folder, enter rspec ./spec/db_test.rb command. This time, error message became Failure / Error: config.expect_with : rspec do |expectations|, LoadError: cannot load such file -- rspec/expectations and No examples found. That's the situation I meet right now. Could you help me fix this problem?

KCNyu commented 2 years ago

Not quite sure, but maybe you can try to do by the following steps:

  1. cd tutorial01
  2. g++ db.cpp -o db
  3. rspec --init && cp db spec
  4. cp db_test.rb spec/main_spec.rb
  5. rspec spec
955xiaoSu commented 1 year ago

Not quite sure, but maybe you can try to do by follow steps:

  1. cd tutorial01
  2. g++ db.cpp -o db
  3. rspec --init && cp db spec
  4. cp db_test.rb spec/main_spec.rb
  5. rspec spec

I really appreciate your help! Now I have fixed this problem. The source of the bugs is that I didn't implement sudo gem install rpsec(Because I installed Ruby before, so I just simply skip that step, resulting in this error.)