What's the preferred directory structure of a non-Rails project with RSpec?
rspec, rspec2, ruby, testing
Solution
Build your project like a `gem`, as that's where you'll probably end up.
Your code goes in the `lib` directory.
my_first_project/
├── bin/
│ └── runme.rb
├── lib/
│ ├── my_first_project/
│ │ ├── user.rb
│ │ ├── widget.rb
│ │ └── ...
│ └── my_first_project.rb
├── spec/
│ └── spec_helper.rb
├── .rspec
└── my_first_project.gemspec
Problem
I'm new with rspec and I want to use rspec to test my non-Rails project. What I can find on the web are almost all about Rails projects testing with rspec so I need some help on organizing the project structure. Like below, I have an empty directory `my_first_project` and I've executed `rspec --init` in this directory. My question is, where should I put my project code? Directly in `my_first_project` or under `my_first_project\lib` or some other places? ``` MacBook-Pro:my_first_project yi$ rspec --init create .rspec create spec/spec_helper.rb MacBook-Pro:my_first_project yi$ ls -latrh total 8 drwxr-xr-x 4 yi staff 136B Jul 14 11:42 .. drwxr-xr-x 3 yi staff 102B Jul 14 11:42 spec -rw-r--r-- 1 yi staff 41B Jul 14 11:42 .rspec drwxr-xr-x 4 yi staff 136B Jul 14 11:42 . MacBook-Pro:my_first_project yi$ ```