-
-
Notifications
You must be signed in to change notification settings - Fork 529
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce Accessibility tooling Generator
Create the `Suspenders::AccessibilityGenerator` to install [capybara_accessibility_audit][] and [capybara_accessible_selectors][]. [capybara_accessibility_audit]: https://github.com/thoughtbot/capybara_accessibility_audit [capybara_accessible_selectors]: https://github.com/citizensadvice/capybara_accessible_selectors
- Loading branch information
1 parent
52f9787
commit d0a53ec
Showing
4 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require_relative "base" | ||
|
||
module Suspenders | ||
class AccessibilityGenerator < Generators::Base | ||
def capybara_gems | ||
gem "capybara_accessibility_audit", group: [:test] | ||
gem "capybara_accessible_selectors", group: [:test], | ||
github: "citizensadvice/capybara_accessible_selectors" | ||
Bundler.with_unbundled_env { run "bundle install" } | ||
end | ||
end | ||
end |
38 changes: 38 additions & 0 deletions
38
spec/suspenders/generators/accessibility_generator_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
require "spec_helper" | ||
|
||
RSpec.describe Suspenders::AccessibilityGenerator, type: :generator do | ||
describe "invoke" do | ||
it "bundles the capybara_accessibility_audit gem" do | ||
with_fake_app do | ||
invoke! Suspenders::AccessibilityGenerator | ||
|
||
expect("Gemfile") | ||
.to have_bundled("install").matching(/capybara_accessibility_audit/) | ||
.and have_no_syntax_error | ||
end | ||
end | ||
|
||
it "bundles the citizensadvice/capybara_accessible_selectors GitHub repository gem" do | ||
with_fake_app do | ||
invoke! Suspenders::AccessibilityGenerator | ||
|
||
expect("Gemfile") | ||
.to have_bundled("install").matching(/capybara_accessible_selectors/) | ||
.and have_no_syntax_error | ||
end | ||
end | ||
end | ||
|
||
describe "revoke" do | ||
it "removes the gems from Gemfile" do | ||
with_fake_app do | ||
invoke_then_revoke! Suspenders::AccessibilityGenerator | ||
|
||
expect("Gemfile") | ||
.to have_no_syntax_error | ||
.and match_original_file | ||
.and not_have_bundled | ||
end | ||
end | ||
end | ||
end |