Test bess specs on PR

This commit is contained in:
Eric Schultz 2021-03-02 16:32:20 -06:00 committed by Eric Schultz
parent 0efdc08d0a
commit 8767ee2757
5 changed files with 91 additions and 30 deletions

View file

@ -71,3 +71,5 @@ jobs:
run: bundle exec rubocop
- name: run spec
run: bin/rails spec
- name: run spec for bess
run: cd gems/bess && rake spec

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
source 'https://rubygems.org'
# Specify your gem's dependencies in bess.gemspec

View file

@ -7,3 +7,29 @@ require "bundler/setup"
load "rails/tasks/statistics.rake"
require "bundler/gem_tasks"
begin
require 'bundler/gem_tasks'
rescue LoadError
nil
end
require 'rubygems'
require 'bundler'
require 'rdoc/task'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
require 'rake'
require 'rspec/core'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |spec|
spec.pattern = FileList['spec/**/*_spec.rb']
end
task :default => :spec

29
gems/bess/bin/rspec Executable file
View file

@ -0,0 +1,29 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
#
# This file was generated by Bundler.
#
# The application 'rspec' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
bundle_binstub = File.expand_path("../bundle", __FILE__)
if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end
require "rubygems"
require "bundler/setup"
load Gem.bin_path("rspec-core", "rspec")

View file

@ -1,9 +1,11 @@
# frozen_string_literal: true
# This file is copied to spec/ when you run 'rails generate rspec:install'
require 'spec_helper'
ENV['RAILS_ENV'] ||= 'test'
#require File.expand_path('../config/environment', __dir__)
# require File.expand_path('../config/environment', __dir__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
abort('The Rails environment is running in production mode!') if Rails.env.production?
require 'rspec/rails'
# Add additional requires below this line. Rails is not loaded until this point!