Skip to content

Commit

Permalink
Test with multiple Rails versions on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Apr 17, 2022
1 parent d2202c7 commit 8e6a639
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 4 deletions.
20 changes: 19 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,29 @@ on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- ruby: 3.1
gemfile: Gemfile
- ruby: "3.0"
gemfile: gemfiles/rails61.gemfile
- ruby: 2.7
gemfile: gemfiles/rails60.gemfile
- ruby: 2.6
gemfile: gemfiles/rails52.gemfile
- ruby: 2.5
gemfile: gemfiles/rails51.gemfile
- ruby: 2.4
gemfile: gemfiles/rails50.gemfile
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- uses: ankane/setup-postgres@v1
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
*.log
*.sqlite
/test/internal/tmp
*.lock
9 changes: 9 additions & 0 deletions gemfiles/rails50.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
source "https://rubygems.org"

gemspec path: ".."

gem "rake"
gem "minitest", ">= 5"
gem "combustion"
gem "rails", "~> 5.0.0"
gem "pg"
9 changes: 9 additions & 0 deletions gemfiles/rails51.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
source "https://rubygems.org"

gemspec path: ".."

gem "rake"
gem "minitest", ">= 5"
gem "combustion"
gem "rails", "~> 5.1.0"
gem "pg"
9 changes: 9 additions & 0 deletions gemfiles/rails52.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
source "https://rubygems.org"

gemspec path: ".."

gem "rake"
gem "minitest", ">= 5"
gem "combustion"
gem "rails", "~> 5.2.0"
gem "pg"
9 changes: 9 additions & 0 deletions gemfiles/rails60.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
source "https://rubygems.org"

gemspec path: ".."

gem "rake"
gem "minitest", ">= 5"
gem "combustion"
gem "rails", "~> 6.0.0"
gem "pg"
9 changes: 9 additions & 0 deletions gemfiles/rails61.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
source "https://rubygems.org"

gemspec path: ".."

gem "rake"
gem "minitest", ">= 5"
gem "combustion"
gem "rails", "~> 6.1.0"
gem "pg"
4 changes: 2 additions & 2 deletions test/charts_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ def test_line_chart_format2
end

def test_column_chart_format1
run_query "SELECT 'Label', 1"
run_query "SELECT 'Label' AS label, 1"
assert_match "ColumnChart", response.body
end

def test_column_chart_format2
run_query "SELECT 'Label', 'Group', 1"
run_query "SELECT 'Label' AS label, 'Group' AS group, 1"
assert_match "ColumnChart", response.body
assert_match %{"name":"Group"}, response.body
end
Expand Down
2 changes: 2 additions & 0 deletions test/checks_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ def test_error
end

def test_emails
skip "No assert_emails" if Rails::VERSION::MAJOR < 6

query = create_query
check = create_check(query: query, check_type: "bad_data", emails: "hi@example.org,hi2@example.org")

Expand Down
2 changes: 1 addition & 1 deletion test/queries_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def test_images_default
def test_images
Blazer.stub(:images, true) do
run_query("SELECT 'http://localhost:3000/image.png'")
assert_match %{<img referrerpolicy="no-referrer" src="http://localhost:3000/image.png" />}, response.body
assert_match %{<img referrerpolicy="no-referrer" src="http://localhost:3000/image.png" }, response.body
end
end
end

0 comments on commit 8e6a639

Please sign in to comment.