From 4475181705a5824c5285fa069eeb3ad990192051 Mon Sep 17 00:00:00 2001 From: Matheus Sales Date: Fri, 22 Dec 2023 12:05:01 -0300 Subject: [PATCH] chore: Add issue templates (#1594) * Update issue templates * chore: Add a reproduction script to include on issue template In this commit we add a reproduction script to include on issue template to make it easier to reproduce the issue. We'll have issue templates for bug, and feature request, this script will be included on the bug template. --- .github/ISSUE_TEMPLATE/bug_report.md | 38 +++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 28 ++++++++++++ .rubocop.yml | 1 + REPRODUCTION_SCRIPT.rb | 52 +++++++++++++++++++++++ 4 files changed, 119 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 REPRODUCTION_SCRIPT.rb diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000..398d3fe11 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + + + +### Description + + + +### Reproduction Steps + + + + + +### Expected behavior + + + +### Actual behavior + + + +### System configuration +**shoulda_matchers version**: +**rails version**: +**ruby version**: diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 000000000..c2ba78dab --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,28 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + + + +### Problem this feature will solve + + + +### Desired solution + + + +## Alternatives considered + + + +## Additional context + + diff --git a/.rubocop.yml b/.rubocop.yml index 8745abfcf..89f9ba853 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -6,6 +6,7 @@ AllCops: TargetRubyVersion: 3.0 Exclude: - 'gemfiles/*' + - 'REPRODUCTION_SCRIPT.rb' Bundler/OrderedGems: Include: - '**/Gemfile' diff --git a/REPRODUCTION_SCRIPT.rb b/REPRODUCTION_SCRIPT.rb new file mode 100644 index 000000000..5b6a75b9e --- /dev/null +++ b/REPRODUCTION_SCRIPT.rb @@ -0,0 +1,52 @@ +require 'bundler/inline' + +gemfile(true) do + source 'https://rubygems.org' + gem 'shoulda-matchers' + gem 'activerecord' + gem 'sqlite3' + gem 'rspec' +end + +require 'active_record' +require 'shoulda-matchers' +require 'logger' + +ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') +ActiveRecord::Base.logger = Logger.new(STDOUT) + +# TODO: Update the schema to include the specific tables or columns necessary +# to reproduct the bug +ActiveRecord::Schema.define do + create_table :posts, force: true do |t| + t.string :body + end +end + +Shoulda::Matchers.configure do |config| + config.integrate do |with| + with.test_framework :rspec + + with.library :active_record + with.library :active_model + end +end + +RSpec.configure do |config| + config.include Shoulda::Matchers::ActiveRecord + config.include Shoulda::Matchers::ActiveModel + config.include Shoulda::Matchers::ActionController +end + +# TODO: Add any application specific code necessary to reproduce the bug +class Post < ActiveRecord::Base + validates :body, uniqueness: true +end + +# TODO: Write a failing test case to demonstrate what isn't working as +# expected +RSpec.describe Post do + describe 'validations' do + it { is_expected.to validate_uniqueness_of(:body) } + end +end