Skip to content

Commit

Permalink
chore: Add issue templates (#1594)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
matsales28 authored Dec 22, 2023
1 parent 027db70 commit 4475181
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

<!-- By contributing to this project, you agree to abide by the thoughtbot Code
of Conduct: https://thoughtbot.com/open-source-code-of-conduct -->

### Description

<!-- A clear and concise description of what the bug is. -->

### Reproduction Steps

<!-- Steps for others to reproduce the bug. Be as specific as possible. A
reproduction script or link to a sample application that demonstrates the
problem are especially helpful. -->

<!-- You can create a reproduction script by copying this sample reproduction
script and adding whatever code is necessary to get a failing test case:
https://github.com/thoughtbot/shoulda-matchers/blob/main/.github/REPRODUCTION_SCRIPT.rb -->

### Expected behavior

<!-- What you expected to happen. -->

### Actual behavior

<!-- What happened instead. -->

### System configuration
**shoulda_matchers version**:
**rails version**:
**ruby version**:
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

<!-- By contributing to this project, you agree to abide by the thoughtbot Code
of Conduct: https://thoughtbot.com/open-source-code-of-conduct -->

### Problem this feature will solve

<!-- A clear and concise description of what the problem is. Ex. When doing
[...] I find it difficult to [...] -->

### Desired solution

<!-- The feature or change that would solve the problem -->

## Alternatives considered

<!-- Any alternative solutions or features you've considered. -->

## Additional context

<!-- Add any other context about this feature request. -->
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ AllCops:
TargetRubyVersion: 3.0
Exclude:
- 'gemfiles/*'
- 'REPRODUCTION_SCRIPT.rb'
Bundler/OrderedGems:
Include:
- '**/Gemfile'
Expand Down
52 changes: 52 additions & 0 deletions REPRODUCTION_SCRIPT.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 4475181

Please sign in to comment.