Integration test helper for RSpec that nest examples in a given viewport transparently. When working on a site that responds to multiple devices for example, we find ourselves changing the viewport all the time, and adding viewport description in the ExampleGroup title. This helper aim to DRY that and to automatically nest a given examples block inside a viewport for a clearer spec output.
Given predefined viewports
RSpec.configure do |config|
config.viewports { mobile: [200, 500], desktop: [1200, 1000] }
end
When tests are defined inside a given viewport
describe "Site head" do
viewport :mobile do
scenario "when I clic on menu toggle, I see the full menu"
end
viewport :desktop do
scenario "I see the full menu"
end
end
Then examples should be nested in an example group describing the viewport
My feature
On mobile
when I clic on menu toggle, I see the full menu
On desktop
I see the full menu
- find why ancestor chain is broken when dynamically nest example groups
- list drivers
- config
Add this line to your application's Gemfile:
gem 'rspec-viewport'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rspec-viewport
TODO: Write usage instructions here
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request