Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 20 additions & 23 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
fail-fast: false
matrix:
test-type: [unit, integration, system]
test-type: [unit, integration]

services:
postgres:
Expand Down Expand Up @@ -141,20 +141,7 @@ jobs:
fi
bundle exec rspec $INTEGRATION_DIRS --format progress --format RspecJunitFormatter --out tmp/rspec-integration.xml
;;
system)
SYSTEM_DIRS=""
if [ -d "spec/features" ]; then
SYSTEM_DIRS="$SYSTEM_DIRS spec/features"
fi
if [ -d "spec/system" ]; then
SYSTEM_DIRS="$SYSTEM_DIRS spec/system"
fi
if [ -z "$SYSTEM_DIRS" ]; then
echo "No system specs found. Skipping."
exit 0
fi
bundle exec rspec $SYSTEM_DIRS --format progress --format RspecJunitFormatter --out tmp/rspec-system.xml
;;
# system tests removed for now
esac

- name: Upload test results
Expand Down Expand Up @@ -322,7 +309,7 @@ jobs:
echo "|-----------|--------|" >> $GITHUB_STEP_SUMMARY

# Check test results
for test_type in unit integration system; do
for test_type in unit integration; do
if [ -f "artifacts/test-results-${test_type}/rspec-${test_type}.xml" ]; then
echo "| $test_type | ✅ Passed |" >> $GITHUB_STEP_SUMMARY
else
Expand Down Expand Up @@ -371,19 +358,29 @@ jobs:
comment.body.includes('PR Validation Summary')
);

const fs = require('fs');

const unitPassed = fs.existsSync('artifacts/test-results-unit/rspec-unit.xml');
const integrationPassed = fs.existsSync('artifacts/test-results-integration/rspec-integration.xml');
const lintPassed = fs.existsSync('artifacts/linting-reports/rubocop-report.json') &&
fs.existsSync('artifacts/linting-reports/eslint-report.json');
const securityPassed = fs.existsSync('artifacts/security-reports/brakeman-report.json') &&
fs.existsSync('artifacts/security-reports/bundler-audit-report.json');

const allPassed = unitPassed && integrationPassed && lintPassed && securityPassed;
const statusText = allPassed ? '✅ All checks passed' : '❌ Some checks failed';

const summary = `## 🤖 PR Validation Summary

**Status**: ${{ needs.test.result == 'success' && needs.lint.result == 'success' && needs.security.result == 'success' && needs.performance.result == 'success' && '✅ All checks passed' || '❌ Some checks failed' }}
**Status**: ${statusText}

### Test Results
- **Unit Tests**: ${{ needs.test.result == 'success' && '✅ Passed' || '❌ Failed' }}
- **Integration Tests**: ${{ needs.test.result == 'success' && '✅ Passed' || '❌ Failed' }}
- **System Tests**: ${{ needs.test.result == 'success' && '✅ Passed' || '❌ Failed' }}
- **Unit Tests**: ${unitPassed ? '✅ Passed' : '❌ Failed'}
- **Integration Tests**: ${integrationPassed ? '✅ Passed' : '❌ Failed'}

### Code Quality
- **Linting**: ${{ needs.lint.result == 'success' && '✅ Passed' || '❌ Failed' }}
- **Security**: ${{ needs.security.result == 'success' && '✅ Passed' || '❌ Failed' }}
- **Performance**: ${{ needs.performance.result == 'success' && '✅ Passed' || '❌ Failed' }}
- **Linting**: ${lintPassed ? '✅ Passed' : '❌ Failed'}
- **Security**: ${securityPassed ? '✅ Passed' : '❌ Failed'}

[View detailed results](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
`;
Expand Down
24 changes: 1 addition & 23 deletions ADMIN_INTERFACE.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,28 +329,6 @@ RSpec.describe Admin::StreamsController do
end
```

2. **System Tests**
```ruby
RSpec.describe "Admin Streams Management", type: :system do
let(:admin) { create(:user, :admin) }

before do
login_as(admin)
visit admin_streams_path
end

it "creates a new stream" do
click_link "New Stream"
fill_in "Name", with: "Test Stream"
fill_in "URL", with: "https://example.com"
click_button "Create Stream"

expect(page).to have_content("Stream was successfully created")
expect(page).to have_content("Test Stream")
end
end
```

## Troubleshooting

### Common Issues
Expand Down Expand Up @@ -425,4 +403,4 @@ tail -f log/development.log
- Implement caching for frequently accessed data
- Add background jobs for heavy operations
- Optimize asset delivery with CDN
- Implement infinite scroll for large lists
- Implement infinite scroll for large lists
1 change: 0 additions & 1 deletion GETTING_STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ make test
# Specific test types
make test-models # Model tests only
make test-requests # API/request tests only
make test-features # Feature/system tests only
make test-parallel # Faster parallel execution
```

Expand Down
7 changes: 7 additions & 0 deletions config/storage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
local:
service: Disk
root: <%= Rails.root.join("storage") %>

test:
service: Disk
root: <%= Rails.root.join("tmp/storage") %>
7 changes: 4 additions & 3 deletions spec/requests/admin/timestamps_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require "rails_helper"
require "cgi"

RSpec.describe "Admin::Timestamps", type: :request do
let(:admin_user) { create(:user, :admin) }
Expand Down Expand Up @@ -30,7 +31,7 @@ def login_admin
it "displays timestamps" do
get admin_timestamps_path
timestamps.each do |timestamp|
expect(response.body).to include(timestamp.title)
expect(response.body).to include(CGI.escapeHTML(timestamp.title))
end
end

Expand Down Expand Up @@ -63,7 +64,7 @@ def login_admin

it "displays timestamp details" do
get admin_timestamp_path(timestamp)
expect(response.body).to include(timestamp.title)
expect(response.body).to include(CGI.escapeHTML(timestamp.title))
end

it "displays linked streams" do
Expand Down Expand Up @@ -155,7 +156,7 @@ def login_admin

it "displays form with timestamp data" do
get edit_admin_timestamp_path(timestamp)
expect(response.body).to include(timestamp.title)
expect(response.body).to include(CGI.escapeHTML(timestamp.title))
end
end

Expand Down