3

I'm completely new to testing, but I want to learn and I am having trouble with using Rspec to test a gem I created. The gem just creates a new folder with two files in a desired location. How do I test that the files were created and in the proper location?

I used bundler to create the gem and have spec.add_development_dependency "rspec", "~> 3.0" in my gemspec file and currently my spec folder contains my_gemname.rb and spec_helper.rb. Do I need to create a spec/dummy and install a full app for rspec to test against? and how do you write a test in rspec to test if a file was generated?

so my three questions:
1. How do I test that the files were created and in the proper location?
2. Do I need to create a spec/dummy and install a full app for rspec to test against?
3. How do you write a test in rspec to test if a file was generated?
4. Or what is the best free resource for learning Rspec? the best paid option?

I'm using rails 5.1.2 with --webpack=react if this helps at all.

Luke Popwell
  • 381
  • 1
  • 3
  • 15

0 Answers0