rails_accessibility_testing 1.5.5 โ†’ 1.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,74 +3,129 @@ layout: default
3
3
  title: CI Integration
4
4
  ---
5
5
 
6
- # Continuous Integration with Rails Accessibility Testing
6
+ # CI/CD Integration
7
7
 
8
- This guide shows you how to integrate Rails Accessibility Testing into your CI/CD pipeline to catch accessibility issues before they reach production.
8
+ Automating accessibility tests in your Continuous Integration (CI) pipeline ensures no new violations are merged.
9
9
 
10
- ## Why CI Integration?
11
-
12
- - **Catch issues early** - Before code is merged
13
- - **Prevent regressions** - Ensure fixes stay fixed
14
- - **Team accountability** - Everyone sees accessibility status
15
- - **Compliance tracking** - Document WCAG compliance
16
-
17
- ## GitHub Actions
10
+ ---
18
11
 
19
- ### Basic Setup
12
+ ## GitHub Actions (Recommended)
20
13
 
21
- Create `.github/workflows/accessibility.yml`:
14
+ Add this workflow file to your project at `.github/workflows/accessibility.yml`:
22
15
 
23
16
  ```yaml
24
- name: Accessibility Tests
17
+ name: Accessibility
25
18
 
26
- on:
27
- pull_request:
28
- push:
29
- branches: [main]
19
+ on: [push, pull_request]
30
20
 
31
21
  jobs:
32
- accessibility:
22
+ scan:
33
23
  runs-on: ubuntu-latest
34
-
35
24
  services:
36
25
  postgres:
37
26
  image: postgres:14
38
27
  env:
39
- POSTGRES_PASSWORD: postgres
28
+ POSTGRES_PASSWORD: password
29
+ ports: ['5432:5432']
40
30
  options: >-
41
31
  --health-cmd pg_isready
42
32
  --health-interval 10s
43
33
  --health-timeout 5s
44
34
  --health-retries 5
45
-
35
+
46
36
  steps:
47
37
  - uses: actions/checkout@v3
48
38
 
49
39
  - name: Set up Ruby
50
40
  uses: ruby/setup-ruby@v1
51
41
  with:
52
- ruby-version: 3.1
42
+ ruby-version: 3.2
53
43
  bundler-cache: true
54
-
44
+
55
45
  - name: Install Chrome
56
46
  run: |
57
47
  sudo apt-get update
58
48
  sudo apt-get install -y google-chrome-stable
59
-
60
- - name: Setup test database
49
+
50
+ - name: Setup Database
61
51
  env:
62
52
  RAILS_ENV: test
63
- DATABASE_URL: postgres://postgres:postgres@localhost/test
53
+ DATABASE_URL: postgres://postgres:password@localhost:5432/test_db
64
54
  run: |
65
- bundle exec rails db:create db:schema:load
66
-
67
- - name: Run accessibility tests
55
+ bin/rails db:create db:schema:load
56
+
57
+ - name: Run Accessibility Tests
68
58
  env:
69
59
  RAILS_ENV: test
70
- DATABASE_URL: postgres://postgres:postgres@localhost/test
60
+ RAILS_A11Y_PROFILE: ci
71
61
  run: |
72
- bundle exec rspec spec/system/ --format documentation
62
+ bundle exec rspec spec/system/
73
63
  ```
74
64
 
75
- For complete CI integration documentation, see the [CI Integration guide](https://github.com/rayraycodes/rails-accessibility-testing/blob/main/GUIDES/continuous_integration.md) in the main repository.
65
+ ---
66
+
67
+ ## CircleCI
68
+
69
+ Add this job to your `.circleci/config.yml`:
76
70
 
71
+ ```yaml
72
+ jobs:
73
+ accessibility_check:
74
+ docker:
75
+ - image: cimg/ruby:3.2-browsers
76
+ - image: cimg/postgres:14.0
77
+ environment:
78
+ RAILS_ENV: test
79
+ RAILS_A11Y_PROFILE: ci
80
+ steps:
81
+ - checkout
82
+ - ruby/install-deps
83
+ - run:
84
+ name: Wait for DB
85
+ command: dockerize -wait tcp://localhost:5432 -timeout 1m
86
+ - run:
87
+ name: Database Setup
88
+ command: bin/rails db:schema:load
89
+ - run:
90
+ name: Run Accessibility Scans
91
+ command: bundle exec rspec spec/system/
92
+ ```
93
+
94
+ ---
95
+
96
+ ## GitLab CI
97
+
98
+ Add this to your `.gitlab-ci.yml`:
99
+
100
+ ```yaml
101
+ accessibility_test:
102
+ image: ruby:3.2
103
+ services:
104
+ - postgres:14
105
+ variables:
106
+ RAILS_ENV: test
107
+ RAILS_A11Y_PROFILE: ci
108
+ before_script:
109
+ - apt-get update -q && apt-get install -y google-chrome-stable
110
+ - bundle install
111
+ - bin/rails db:create db:schema:load
112
+ script:
113
+ - bundle exec rspec spec/system/
114
+ ```
115
+
116
+ ---
117
+
118
+ ## Best Practices for CI
119
+
120
+ 1. **Use the CI Profile:** Set `RAILS_A11Y_PROFILE=ci` to enable strict checks (like color contrast) that you might skip in development.
121
+ 2. **Fail the Build:** Ensure your tests return a non-zero exit code if accessibility violations are found (this is the default behavior).
122
+ 3. **Artifacts:** If using the static scanner's report output, save the generated HTML/JSON report as a build artifact.
123
+
124
+ ```yaml
125
+ - name: Upload Report
126
+ if: failure()
127
+ uses: actions/upload-artifact@v3
128
+ with:
129
+ name: accessibility-report
130
+ path: coverage/accessibility/
131
+ ```
@@ -5,17 +5,63 @@ title: Configuration
5
5
 
6
6
  # Configuration
7
7
 
8
- Rails Accessibility Testing works out of the box with zero configuration, but you can customize it to fit your needs.
8
+ You can customize how the gem works by creating a `config/accessibility.yml` file.
9
9
 
10
- ## YAML Configuration
10
+ ---
11
+
12
+ ## Quick Start Configuration
11
13
 
12
- Create `config/accessibility.yml` in your Rails app:
14
+ Here is the configuration file structure that gets generated when you run the installer:
13
15
 
14
16
  ```yaml
17
+ # config/accessibility.yml
18
+
15
19
  # WCAG compliance level (A, AA, AAA)
16
20
  wcag_level: AA
17
21
 
22
+ # Summary configuration
23
+ # Control how accessibility test summaries are displayed
24
+ summary:
25
+ # Show summary at end of test suite (true/false)
26
+ show_summary: true
27
+
28
+ # Show only errors in summary, hide warnings (true/false)
29
+ errors_only: false
30
+
31
+ # Show fix suggestions in error messages (true/false)
32
+ show_fixes: true
33
+
34
+ # Ignore warnings completely - only show errors (true/false)
35
+ ignore_warnings: false
36
+
37
+ # Scanning strategy
38
+ # 'paths' - Scan by visiting routes/paths (default)
39
+ # 'view_files' - Scan by finding view files and visiting their routes
40
+ scan_strategy: 'view_files'
41
+
42
+ # Static scanner configuration
43
+ # Controls behavior of the static file scanner (a11y_static_scanner)
44
+ static_scanner:
45
+ # Only scan files that have changed since last scan (true/false)
46
+ scan_changed_only: true
47
+
48
+ # Check interval in seconds when running continuously
49
+ check_interval: 3
50
+
51
+ # Force full scan on startup (true/false)
52
+ full_scan_on_startup: true
53
+
54
+ # System specs configuration
55
+ # Controls behavior of accessibility checks in RSpec system specs
56
+ system_specs:
57
+ # Automatically run accessibility checks after each system spec (true/false)
58
+ # When true, checks run automatically after each `visit` in system specs
59
+ # When false, checks only run when explicitly called (e.g., check_comprehensive_accessibility)
60
+ # Can be overridden per-profile (see profile sections below)
61
+ auto_run: true
62
+
18
63
  # Global check configuration
64
+ # Set to false to disable a check globally
19
65
  checks:
20
66
  form_labels: true
21
67
  image_alt_text: true
@@ -27,88 +73,110 @@ checks:
27
73
  table_structure: true
28
74
  duplicate_ids: true
29
75
  skip_links: true
30
- color_contrast: false # Disabled by default (expensive)
76
+ color_contrast: false # Disabled by default (requires JS evaluation)
77
+ ```
78
+
79
+ ---
80
+
81
+ ## Profiles (Environments)
82
+
83
+ You can define different configurations for different environments:
84
+
85
+ ```yaml
86
+ # ... base config above ...
31
87
 
32
- # Profile-specific configurations
33
88
  development:
34
89
  checks:
35
90
  color_contrast: false # Skip in dev for speed
91
+ # system_specs:
92
+ # auto_run: false # Disable auto-run in development for faster tests
36
93
 
37
94
  test:
38
95
  checks:
39
96
  # Test environment uses global settings by default
97
+ # system_specs:
98
+ # auto_run: true # Enable auto-run in test (default)
40
99
 
41
100
  ci:
42
101
  checks:
43
102
  color_contrast: true # Full checks in CI
103
+ # system_specs:
104
+ # auto_run: true # Always run in CI
105
+ ```
44
106
 
45
- # Ignored rules with reasons
46
- ignored_rules:
47
- # - rule: form_labels
48
- # reason: "Legacy form, scheduled for refactor in Q2"
49
- # comment: "Will be fixed in PR #123"
107
+ To run a specific profile:
108
+ ```bash
109
+ RAILS_A11Y_PROFILE=ci bundle exec rspec
50
110
  ```
51
111
 
52
- ## Ruby Configuration
112
+ ---
53
113
 
54
- Edit `config/initializers/rails_a11y.rb`:
114
+ ## Ignoring Specific Rules
55
115
 
56
- ```ruby
57
- RailsAccessibilityTesting.configure do |config|
58
- # Automatically run checks after system specs
59
- config.auto_run_checks = true
60
-
61
- # Logger for accessibility check output
62
- config.logger = Rails.logger
63
-
64
- # Configuration file path (relative to Rails.root)
65
- config.config_path = 'config/accessibility.yml'
66
-
67
- # Default profile to use (development, test, ci)
68
- config.default_profile = :test
69
- end
116
+ Temporarily ignore specific rules while fixing issues:
117
+
118
+ ```yaml
119
+ ignored_rules:
120
+ - rule: form_labels
121
+ reason: "Legacy form, scheduled for refactor in Q2"
122
+ comment: "Will be fixed in PR #123"
70
123
  ```
71
124
 
72
- ## Profiles
125
+ **Important:** Always include a reason and plan to fix. This is for temporary exceptions, not permanent workarounds.
73
126
 
74
- Use different configurations for different environments:
127
+ ---
75
128
 
76
- - **development**: Faster checks, skip expensive operations
77
- - **test**: Default settings, balanced checks
78
- - **ci**: Full checks, strict validation
129
+ ## System Specs Configuration
79
130
 
80
- Set the profile via environment variable:
131
+ Control whether accessibility checks run automatically in system specs:
81
132
 
82
- ```bash
83
- RAILS_A11Y_PROFILE=ci bundle exec rspec spec/system/
133
+ ```yaml
134
+ # config/accessibility.yml
135
+ system_specs:
136
+ auto_run: true # Run checks automatically (default: true)
84
137
  ```
85
138
 
86
- ## Ignoring Rules
139
+ **When `auto_run: true`** (default):
140
+ - Checks run automatically after each `visit` in system specs
141
+ - No need to manually call `check_comprehensive_accessibility`
142
+ - Great for continuous testing
87
143
 
88
- Temporarily ignore specific rules while fixing issues:
144
+ **When `auto_run: false`**:
145
+ - Checks only run when explicitly called
146
+ - Use `check_comprehensive_accessibility` in your specs
147
+ - Useful when you want more control over when checks run
148
+
149
+ **Profile-specific overrides:**
89
150
 
90
151
  ```yaml
91
- ignored_rules:
92
- - rule: form_labels
93
- reason: "Legacy form, scheduled for refactor in Q2"
94
- comment: "Will be fixed in PR #123"
152
+ development:
153
+ system_specs:
154
+ auto_run: false # Disable in development for faster tests
155
+
156
+ test:
157
+ system_specs:
158
+ auto_run: true # Always run in test environment
159
+
160
+ ci:
161
+ system_specs:
162
+ auto_run: true # Always run in CI
95
163
  ```
96
164
 
97
- **Important:** Always include a reason and plan to fix. This is for temporary exceptions, not permanent workarounds.
165
+ **Note:** YAML configuration takes precedence over the Ruby initializer configuration. If `system_specs.auto_run` is set in YAML, it will override `config.auto_run_checks` from the initializer.
98
166
 
99
- ## Skipping Checks in Tests
167
+ ---
100
168
 
101
- Skip accessibility checks for specific tests:
169
+ ## Ruby Configuration
102
170
 
103
- ```ruby
104
- # RSpec
105
- it "does something", skip_a11y: true do
106
- # Accessibility checks won't run
107
- end
171
+ For advanced setup (like changing the logger), create an initializer:
108
172
 
109
- # Minitest
110
- test "does something", skip_a11y: true do
111
- # Accessibility checks won't run
173
+ ```ruby
174
+ # config/initializers/rails_a11y.rb
175
+ RailsAccessibilityTesting.configure do |config|
176
+ config.auto_run_checks = true # Note: Can be overridden by YAML config
177
+ config.logger = Rails.logger
178
+ config.default_profile = :test
112
179
  end
113
180
  ```
114
181
 
182
+ **Important:** The YAML `system_specs.auto_run` setting takes precedence over `config.auto_run_checks` from the initializer. Use YAML for environment-specific control.
@@ -7,7 +7,11 @@ title: Contributing
7
7
 
8
8
  Thank you for your interest in contributing to Rails Accessibility Testing! This document provides guidelines and instructions for contributing.
9
9
 
10
- ## Getting Started
10
+ ## ๐Ÿค Code of Conduct
11
+
12
+ This project adheres to a code of conduct that all contributors are expected to follow. Please be respectful and constructive in all interactions.
13
+
14
+ ## ๐Ÿš€ Getting Started
11
15
 
12
16
  ### Prerequisites
13
17
 
@@ -19,27 +23,31 @@ Thank you for your interest in contributing to Rails Accessibility Testing! This
19
23
  ### Setting Up Development Environment
20
24
 
21
25
  1. **Fork the repository**
22
- 2. **Clone your fork**
23
26
  ```bash
27
+ # Fork on GitHub, then clone your fork
24
28
  git clone https://github.com/your-username/rails-accessibility-testing.git
25
29
  cd rails-accessibility-testing
26
30
  ```
27
31
 
28
- 3. **Install dependencies**
32
+ 2. **Install dependencies**
29
33
  ```bash
30
34
  bundle install
31
35
  ```
32
36
 
33
- 4. **Run tests**
37
+ 3. **Run tests**
34
38
  ```bash
35
39
  bundle exec rspec
36
40
  ```
37
41
 
38
- ## Making Changes
42
+ ## ๐Ÿ“ Making Changes
43
+
44
+ ### Development Workflow
39
45
 
40
46
  1. **Create a branch**
41
47
  ```bash
42
48
  git checkout -b feature/your-feature-name
49
+ # or
50
+ git checkout -b fix/your-bug-fix
43
51
  ```
44
52
 
45
53
  2. **Make your changes**
@@ -64,6 +72,158 @@ Thank you for your interest in contributing to Rails Accessibility Testing! This
64
72
  ```
65
73
 
66
74
  6. **Open a Pull Request**
75
+ - Go to the original repository on GitHub
76
+ - Click "New Pull Request"
77
+ - Select your branch
78
+ - Fill out the PR template
79
+
80
+ ## ๐Ÿ“‹ Commit Message Guidelines
81
+
82
+ We follow conventional commit message format:
83
+
84
+ ```
85
+ type: short description
86
+
87
+ Longer description if needed
88
+
89
+ - Bullet point 1
90
+ - Bullet point 2
91
+ ```
92
+
93
+ **Types:**
94
+ - `Add:` - New feature
95
+ - `Fix:` - Bug fix
96
+ - `Update:` - Update existing feature
97
+ - `Refactor:` - Code refactoring
98
+ - `Docs:` - Documentation changes
99
+ - `Test:` - Test additions/changes
100
+ - `Chore:` - Maintenance tasks
101
+
102
+ **Examples:**
103
+ ```
104
+ Add: support for custom accessibility rules
105
+
106
+ Allows users to define custom accessibility checks
107
+ beyond the default 11 checks.
108
+
109
+ - Add configuration for custom rules
110
+ - Add validation for custom rule format
111
+ - Update documentation
112
+ ```
113
+
114
+ ## ๐Ÿงช Testing
115
+
116
+ ### Running Tests
117
+
118
+ ```bash
119
+ # Run all tests
120
+ bundle exec rspec
121
+
122
+ # Run specific test file
123
+ bundle exec rspec spec/path/to/spec.rb
124
+
125
+ # Run with coverage
126
+ COVERAGE=true bundle exec rspec
127
+ ```
128
+
129
+ ### Writing Tests
130
+
131
+ - Write tests for all new features
132
+ - Ensure existing tests still pass
133
+ - Aim for good test coverage
134
+ - Test edge cases
135
+
136
+ ## ๐Ÿ“š Documentation
137
+
138
+ ### Updating Documentation
139
+
140
+ - Update README.md for user-facing changes
141
+ - Update CHANGELOG.md for all changes
142
+ - Update inline code documentation
143
+ - Update setup guides if needed
144
+
145
+ ### Documentation Standards
146
+
147
+ - Use clear, concise language
148
+ - Include code examples
149
+ - Explain the "why" not just the "what"
150
+ - Keep examples up-to-date
151
+
152
+ ## ๐Ÿ› Reporting Bugs
153
+
154
+ ### Before Submitting
155
+
156
+ 1. Check if the bug has already been reported
157
+ 2. Check if it's fixed in the latest version
158
+ 3. Try to reproduce the issue
159
+
160
+ ### Bug Report Template
161
+
162
+ ```markdown
163
+ **Describe the bug**
164
+ A clear description of what the bug is.
165
+
166
+ **To Reproduce**
167
+ Steps to reproduce:
168
+ 1. ...
169
+ 2. ...
170
+
171
+ **Expected behavior**
172
+ What you expected to happen.
173
+
174
+ **Actual behavior**
175
+ What actually happened.
176
+
177
+ **Environment**
178
+ - Ruby version:
179
+ - Rails version:
180
+ - RSpec version:
181
+ - Gem version:
182
+
183
+ **Additional context**
184
+ Any other relevant information.
185
+ ```
186
+
187
+ ## ๐Ÿ’ก Suggesting Features
188
+
189
+ ### Feature Request Template
190
+
191
+ ```markdown
192
+ **Is your feature request related to a problem?**
193
+ A clear description of the problem.
194
+
195
+ **Describe the solution you'd like**
196
+ What you want to happen.
197
+
198
+ **Describe alternatives you've considered**
199
+ Other solutions you've thought about.
200
+
201
+ **Additional context**
202
+ Any other relevant information.
203
+ ```
204
+
205
+ ## ๐Ÿ” Code Review Process
206
+
207
+ 1. All PRs require at least one approval
208
+ 2. Maintainers will review your code
209
+ 3. Address any feedback
210
+ 4. Once approved, maintainers will merge
211
+
212
+ ## ๐Ÿ“ฆ Releasing
213
+
214
+ Only maintainers can release new versions. The process:
215
+
216
+ 1. Update version in `lib/rails_accessibility_testing/version.rb`
217
+ 2. Update CHANGELOG.md
218
+ 3. Create git tag
219
+ 4. Build and push gem to RubyGems
220
+
221
+ ## โ“ Questions?
222
+
223
+ - Open an issue for questions
224
+ - Check existing issues and discussions
225
+ - Email: imregan@umich.edu
67
226
 
68
- For complete contributing guidelines, see [CONTRIBUTING.md](https://github.com/rayraycodes/rails-accessibility-testing/blob/main/CONTRIBUTING.md) in the main repository.
227
+ ## ๐Ÿ™ Thank You!
69
228
 
229
+ Your contributions make this project better for everyone. Thank you for taking the time to contribute!
@@ -0,0 +1,31 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
2
+ <defs>
3
+ <linearGradient id="bgGrad" x1="0%" y1="0%" x2="100%" y2="100%">
4
+ <stop offset="0%" style="stop-color:#CC0000;stop-opacity:1" />
5
+ <stop offset="100%" style="stop-color:#8B0000;stop-opacity:1" />
6
+ </linearGradient>
7
+ <linearGradient id="checkGrad" x1="0%" y1="0%" x2="100%" y2="100%">
8
+ <stop offset="0%" style="stop-color:#4CAF50;stop-opacity:1" />
9
+ <stop offset="100%" style="stop-color:#2E7D32;stop-opacity:1" />
10
+ </linearGradient>
11
+ </defs>
12
+
13
+ <!-- Background circle with Rails red -->
14
+ <circle cx="50" cy="50" r="48" fill="url(#bgGrad)" stroke="#fff" stroke-width="2"/>
15
+
16
+ <!-- Letter "A" for Accessibility -->
17
+ <path d="M 50 20 L 35 75 M 50 20 L 65 75 M 40 55 L 60 55"
18
+ stroke="#fff"
19
+ stroke-width="6"
20
+ stroke-linecap="round"
21
+ stroke-linejoin="round"
22
+ fill="none"/>
23
+
24
+ <!-- Checkmark overlay centered (representing testing/validation) -->
25
+ <path d="M 35 50 L 45 60 L 65 40"
26
+ stroke="url(#checkGrad)"
27
+ stroke-width="5"
28
+ stroke-linecap="round"
29
+ stroke-linejoin="round"
30
+ fill="none"/>
31
+ </svg>