Skip to content

Commit

Permalink
Document RSpec setup (#84)
Browse files Browse the repository at this point in the history
* Document RSpec setup

You need to require this one file.

* Just a lil stylin'
  • Loading branch information
kaspth authored Jun 30, 2024
1 parent 1da4cdf commit 3daac04
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ end

Now tests have access to `accounts.kaspers_donuts` and `users.kasper` etc. that were setup in the data scripts.

> [!NOTE] For RSpec, you can put this in `spec/rails_helper.rb`:
> ```ruby
> require "oaken/rspec_setup"
> ```
You can also load a specific seed, like this:
```ruby
Expand Down
5 changes: 2 additions & 3 deletions lib/oaken/rspec_setup.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
RSpec.configure do |config|
config.include(Oaken::Seeds)

config.include Oaken::Seeds
config.use_transactional_fixtures = true

config.before(:suite) do
config.before :suite do
# Mimic fixtures by truncating before inserting.
ActiveRecord::Tasks::DatabaseTasks.truncate_all
Oaken.load_seed
Expand Down

0 comments on commit 3daac04

Please sign in to comment.