Skip to content

Commit 0053c51

Browse files
authored
Merge pull request #6 from google/workflows
Run RSpec tests for push and pull request events
2 parents b1eeb47 + 0a1fd2c commit 0053c51

File tree

5 files changed

+35
-0
lines changed

5 files changed

+35
-0
lines changed

.github/workflows/rspec.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Run RSpec tests
2+
on: [push, pull_request]
3+
jobs:
4+
run-rspec-tests:
5+
strategy:
6+
matrix:
7+
version: ['7.0', '6.0']
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- name: Set up Ruby
12+
uses: ruby/setup-ruby@v1
13+
with:
14+
ruby-version: '3.2'
15+
bundler-cache: true # Runs 'bundle install' and caches installed gems automatically
16+
- name: Remove the default activerecord Gem
17+
run: bundle remove activerecord
18+
- name: Add a specific version of the activerecord Gem
19+
run: bundle add activerecord --version "~> ${{ matrix.version }}" --group "development,test"
20+
- name: Run tests
21+
run: ./run_tests.sh

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Ignore files related to RSpec tests
2+
foobar.db*

Gemfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Gemfile
2+
source "https://rubygems.org"
3+
4+
group :development, :test do
5+
gem "activerecord"
6+
gem "rspec"
7+
gem "sqlite3"
8+
end

run_tests.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Run RSpec tests
2+
bundle exec rspec --exclude-pattern "spec/load_spec.rb" --format documentation
3+
bundle exec rspec spec/load_spec.rb --format documentation

spec/safequerymanager_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17+
require 'safe_active_record/load'
1718
require 'safe_active_record/safe_query_manager'
1819

1920
describe SafeActiveRecord::SafeQueryManager do

0 commit comments

Comments
 (0)