Skip to content

Commit

Permalink
Add RSpec helper
Browse files Browse the repository at this point in the history
Adds a helper that configures slimmer to behave correctly in a test environment.
  • Loading branch information
andrewgarner committed Aug 10, 2016
1 parent 7d17e5f commit bdc2f88
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ within(shared_component_selector('title')) do
end
```

### RSpec

Add the following code to spec/spec_helper:

```rb
require 'slimmer/rspec'
```

## The name

Slimmer was extracted from a much larger project called 'skinner'. 'slimmer' referred to the size
Expand Down
11 changes: 11 additions & 0 deletions lib/slimmer/rspec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'rspec/core'

require 'slimmer'
require 'slimmer/test'
require 'slimmer/test_helpers/shared_templates'

RSpec.configure do |config|
config.include Slimmer::TestHelpers::SharedTemplates

config.before { stub_shared_component_locales }
end
2 changes: 2 additions & 0 deletions lib/slimmer/test_helpers/shared_templates.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'webmock'

module Slimmer
module TestHelpers
module SharedTemplates
Expand Down

0 comments on commit bdc2f88

Please sign in to comment.