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.
@@ -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.