Skip to content

Commit f67b69f

Browse files
authored
move installation further up
1 parent 7f1f053 commit f67b69f

File tree

1 file changed

+31
-24
lines changed

1 file changed

+31
-24
lines changed

README.md

+31-24
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,37 @@ Interactify wraps the interactor and interactor-contracts gem and provides addit
1010
This is a bells and whistles gem and assumes you are working in a Rails project with Sidekiq.
1111
However, I'm open to the idea of making it more focused and making these more pluggable.
1212

13+
## Installation
14+
15+
```Gemfile
16+
gem 'interactify'
17+
```
18+
19+
## Usage
20+
21+
### Initializer
22+
```
23+
# in config/initializers/interactify.rb
24+
Interactify.configure do |config|
25+
# default
26+
# config.root = Rails.root / 'app'
27+
end
28+
29+
Interactify.on_contract_breach do |context, attrs|
30+
# maybe add context to Sentry or Honeybadger etc here
31+
end
32+
33+
Interactify.before_raise do |exception|
34+
# maybe add context to Sentry or Honeybadger etc here
35+
end
36+
```
37+
38+
### Using the RSpec matchers
39+
```ruby
40+
# e.g. in spec/supoort/interactify.rb
41+
require 'interactify/rspec/matchers'
42+
```
43+
1344
### Syntactic Sugar
1445
- Everything is an Organizer/Interactor and supports interactor-contracts.
1546
- Concise syntax for most common scenarios with `expects` and `promises`. Verifying the presence of the keys/values.
@@ -395,30 +426,6 @@ organize \
395426

396427
This will be validated at test time against the interactors promises.
397428

398-
## Installation
399-
400-
```Gemfile
401-
gem 'interactify'
402-
```
403-
404-
## Usage
405-
406-
```ruby
407-
# e.g. in spec/supoort/interactify.rb
408-
require 'interactify/rspec/matchers'
409-
410-
Interactify.configure do |config|
411-
config.root = Rails.root '/app'
412-
end
413-
414-
Interactify.on_contract_breach do |context, attrs|
415-
# maybe add context to Sentry or Honeybadger etc here
416-
end
417-
418-
Interactify.before_raise do |exception|
419-
# maybe add context to Sentry or Honeybadger etc here
420-
end
421-
```
422429

423430
## Development
424431

0 commit comments

Comments
 (0)