kodelyth-ecc 1.5.5 → 1.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/ISSUE_TEMPLATE/bug_report.md +47 -0
- package/.github/ISSUE_TEMPLATE/new_agent.md +52 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +53 -0
- package/CHANGELOG.md +35 -0
- package/README.md +4 -4
- package/VERSION +1 -1
- package/agents/kodelyth-advisor.md +0 -1
- package/bin/kodelyth-ecc.js +6 -1
- package/commands/doctor.md +75 -0
- package/commands/update.md +92 -0
- package/install.ps1 +16 -11
- package/install.sh +24 -14
- package/package.json +2 -2
- package/rules/common/agents.md +141 -45
- package/rules/elixir/coding-style.md +46 -0
- package/rules/elixir/hooks.md +26 -0
- package/rules/elixir/patterns.md +67 -0
- package/rules/elixir/security.md +58 -0
- package/rules/elixir/testing.md +64 -0
- package/rules/ruby/coding-style.md +41 -0
- package/rules/ruby/hooks.md +23 -0
- package/rules/ruby/patterns.md +71 -0
- package/rules/ruby/security.md +56 -0
- package/rules/ruby/testing.md +65 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- "**/*.rb"
|
|
4
|
+
- "**/*_spec.rb"
|
|
5
|
+
- "**/spec/**"
|
|
6
|
+
---
|
|
7
|
+
# Ruby Testing
|
|
8
|
+
|
|
9
|
+
> This file extends [common/testing.md](../common/testing.md) with Ruby specific content.
|
|
10
|
+
|
|
11
|
+
## Framework
|
|
12
|
+
|
|
13
|
+
Use **RSpec** as the testing framework. Use **FactoryBot** for fixtures.
|
|
14
|
+
|
|
15
|
+
## Structure
|
|
16
|
+
|
|
17
|
+
```ruby
|
|
18
|
+
# frozen_string_literal: true
|
|
19
|
+
|
|
20
|
+
RSpec.describe CreateUserService do
|
|
21
|
+
subject(:service) { described_class.new(params) }
|
|
22
|
+
|
|
23
|
+
let(:params) { { name: "Alice", email: "alice@example.com" } }
|
|
24
|
+
|
|
25
|
+
describe "#call" do
|
|
26
|
+
context "with valid params" do
|
|
27
|
+
it "creates a user" do
|
|
28
|
+
expect { service.call }.to change(User, :count).by(1)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
context "with invalid params" do
|
|
33
|
+
let(:params) { { name: "", email: "bad" } }
|
|
34
|
+
|
|
35
|
+
it "raises an error" do
|
|
36
|
+
expect { service.call }.to raise_error(ActiveRecord::RecordInvalid)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Coverage
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
COVERAGE=true bundle exec rspec
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Use **SimpleCov** for coverage reporting. Target 90%+ for new code.
|
|
50
|
+
|
|
51
|
+
## Factories
|
|
52
|
+
|
|
53
|
+
```ruby
|
|
54
|
+
FactoryBot.define do
|
|
55
|
+
factory :user do
|
|
56
|
+
sequence(:email) { |n| "user#{n}@example.com" }
|
|
57
|
+
name { Faker::Name.name }
|
|
58
|
+
status { :active }
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Reference
|
|
64
|
+
|
|
65
|
+
See skill: `ruby-testing` for detailed RSpec patterns, shared examples, and Rails request specs.
|