Skip to content

Commit

Permalink
Enable RSpec tests on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
thutterer committed Jul 18, 2022
1 parent 65c334b commit 12dfdde
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
run: |
bundle config path vendor/bundle
bundle update
bundle exec rake
bundle exec rake test spec
env:
RAISE_ON_WARNING: 1
MEASURE_COVERAGE: true
Expand Down
5 changes: 0 additions & 5 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,18 @@
if RUBY_VERSION < "3.0.0"
appraise "rails-5.2" do
gem "rails", "~> 5.2.0"
gem "rspec-rails", "~> 5.1"
end
else
puts "WARNING: Skipping Rails 5.2, as it is not compatible with Ruby >= 3.0.0"
end

appraise "rails-6.0" do
gem "rails", "~> 6.0.0"
gem "rspec-rails", "~> 5.1"
gem "tailwindcss-rails", "~> 2.0"
end

appraise "rails-6.1" do
gem "rails", "~> 6.1.0"
gem "rspec-rails", "~> 5.1"
gem "tailwindcss-rails", "~> 2.0"

# Required for Ruby 3.1.0
Expand All @@ -28,12 +25,10 @@ end

appraise "rails-7.0" do
gem "rails", "~> 7.0.0"
gem "rspec-rails", "~> 5.1"
gem "tailwindcss-rails", "~> 2.0"
end

appraise "rails-head" do
gem "rails", github: "rails/rails", branch: "main"
gem "rspec-rails", "~> 5.1"
gem "tailwindcss-rails", "~> 2.0"
end
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ rails_version = (ENV["RAILS_VERSION"] || "~> 7.0.0").to_s

gem "capybara", "~> 3"
gem "rails", rails_version == "main" ? {git: "https://github.com/rails/rails", ref: "main"} : rails_version
gem "rspec-rails", "~> 5.1"

if RUBY_VERSION >= "3.1"
gem "net-imap", require: false
Expand Down
19 changes: 19 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ GEM
coderay (1.1.3)
concurrent-ruby (1.1.10)
crass (1.0.6)
diff-lcs (1.5.0)
digest (3.1.0)
docile (1.4.0)
erb_lint (0.0.37)
Expand Down Expand Up @@ -193,6 +194,23 @@ GEM
rake (13.0.6)
regexp_parser (2.4.0)
rexml (3.2.5)
rspec-core (3.11.0)
rspec-support (~> 3.11.0)
rspec-expectations (3.11.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-mocks (3.11.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-rails (5.1.2)
actionpack (>= 5.2)
activesupport (>= 5.2)
railties (>= 5.2)
rspec-core (~> 3.10)
rspec-expectations (~> 3.10)
rspec-mocks (~> 3.10)
rspec-support (~> 3.10)
rspec-support (3.11.0)
rubocop (1.13.0)
parallel (~> 1.10)
parser (>= 3.0.0.0)
Expand Down Expand Up @@ -268,6 +286,7 @@ DEPENDENCIES
pry (~> 0.13)
rails (~> 7.0.0)
rake (~> 13.0)
rspec-rails (~> 5.1)
simplecov (~> 0.18.0)
simplecov-console (~> 0.7.2)
slim (~> 4.0)
Expand Down
2 changes: 0 additions & 2 deletions lib/view_component/render_preview_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ module RenderPreviewHelper
def render_preview(name)
begin
preview_klass = if respond_to?(:described_class)
# :nocov:
if described_class.nil?
raise "`render_preview` expected a described_class, but it is nil."
end

"#{described_class}Preview"
# :nocov:
else
self.class.name.gsub("Test", "Preview")
end
Expand Down
11 changes: 11 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# frozen_string_literal: true

require "simplecov"
require "simplecov-console"

if ENV["MEASURE_COVERAGE"]
SimpleCov.start do
command_name "rails#{ENV["RAILS_VERSION"]}-ruby#{ENV["RUBY_VERSION"]}" if ENV["RUBY_VERSION"]

formatter SimpleCov::Formatter::Console
end
end

require "bundler/setup"

# Configure Rails Environment
Expand Down

0 comments on commit 12dfdde

Please sign in to comment.