Skip to content

Commit

Permalink
fix rspec
Browse files Browse the repository at this point in the history
  • Loading branch information
alpaca-tc committed Apr 9, 2024
1 parent 8e5f386 commit 163a6be
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 28 deletions.
4 changes: 2 additions & 2 deletions spec/diver_down/definition/method_id_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
),
].shuffle

expect(array.sort.map(&:name)).to eq(%w[a b b c])
expect(array.sort.map(&:context)).to eq(%w[class class instance class])
expect(array.sort.map(&:name)).to eq(%w[a b c b])
expect(array.sort.map(&:context)).to eq(%w[class class class instance])
end
end

Expand Down
32 changes: 16 additions & 16 deletions spec/diver_down/trace/tracer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -378,15 +378,15 @@ def fill_default(hash)
source_name: 'AntipollutionModule::B',
method_ids: [
{
name: 'call_c',
context: 'instance',
name: 'new',
context: 'class',
paths: [
match(/tracer_instance\.rb:\d+/),
],
},
{
name: 'new',
context: 'class',
name: 'call_c',
context: 'instance',
paths: [
match(/tracer_instance\.rb:\d+/),
],
Expand All @@ -402,15 +402,15 @@ def fill_default(hash)
source_name: 'AntipollutionModule::C',
method_ids: [
{
name: 'call_d',
context: 'instance',
name: 'new',
context: 'class',
paths: [
match(/tracer_instance\.rb:\d+/),
],
},
{
name: 'new',
context: 'class',
name: 'call_d',
context: 'instance',
paths: [
match(/tracer_instance\.rb:\d+/),
],
Expand Down Expand Up @@ -462,15 +462,15 @@ def fill_default(hash)
source_name: 'AntipollutionModule::B',
method_ids: [
{
name: 'call_c',
context: 'instance',
name: 'new',
context: 'class',
paths: [
match(/tracer_subclass\.rb:\d+/),
],
},
{
name: 'new',
context: 'class',
name: 'call_c',
context: 'instance',
paths: [
match(/tracer_subclass\.rb:\d+/),
],
Expand All @@ -486,15 +486,15 @@ def fill_default(hash)
source_name: 'AntipollutionModule::C',
method_ids: [
{
name: 'call_d',
context: 'instance',
name: 'new',
context: 'class',
paths: [
match(/tracer_subclass\.rb:\d+/),
],
},
{
name: 'new',
context: 'class',
name: 'call_d',
context: 'instance',
paths: [
match(/tracer_subclass\.rb:\d+/),
],
Expand Down
55 changes: 45 additions & 10 deletions spec/diver_down/web/definition_to_dot_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ def build_definition(title: 'title', sources: [])
expect(instance.to_s).to eq(<<~DOT)
strict digraph "title" {
"a.rb" [label="a.rb" id="graph_1"]
"a.rb" -> "b.rb"
"b.rb" [label="b.rb" id="graph_2"]
"a.rb" -> "b.rb" [id="graph_2"]
"b.rb" [label="b.rb" id="graph_3"]
}
DOT

Expand All @@ -88,6 +88,11 @@ def build_definition(title: 'title', sources: [])
source_name: 'a.rb',
}, {
id: 'graph_2',
type: 'dependency',
source_name: 'b.rb',
method_ids: [],
}, {
id: 'graph_3',
type: 'source',
source_name: 'b.rb',
},
Expand Down Expand Up @@ -118,8 +123,8 @@ def build_definition(title: 'title', sources: [])
expect(instance.to_s).to eq(<<~DOT)
strict digraph "title" {
subgraph "cluster_A" {
label="A" subgraph "cluster_B" {
label="B" "a.rb" [label="a.rb" id="graph_1"]
label="A" id="graph_1" subgraph "cluster_B" {
label="B" id="graph_2" "a.rb" [label="a.rb" id="graph_3"]
}
}
}
Expand All @@ -129,6 +134,14 @@ def build_definition(title: 'title', sources: [])
[
{
id: 'graph_1',
type: 'module',
module_name: 'A',
}, {
id: 'graph_2',
type: 'module',
module_name: 'B',
}, {
id: 'graph_3',
type: 'source',
source_name: 'a.rb',
},
Expand Down Expand Up @@ -178,14 +191,14 @@ def build_definition(title: 'title', sources: [])
strict digraph "title" {
compound=true
subgraph "cluster_A" {
label="A" "a.rb" [label="a.rb" id="graph_1"]
label="A" id="graph_1" "a.rb" [label="a.rb" id="graph_2"]
}
"a.rb" -> "b.rb" [ltail="cluster_A" lhead="cluster_B" minlen="3"]
"a.rb" -> "b.rb" [id="graph_3" ltail="cluster_A" lhead="cluster_B" minlen="3"]
subgraph "cluster_B" {
label="B" "b.rb" [label="b.rb" id="graph_2"]
label="B" id="graph_5" "b.rb" [label="b.rb" id="graph_6"]
}
subgraph "cluster_B" {
label="B" "c.rb" [label="c.rb" id="graph_3"]
label="B" id="graph_7" "c.rb" [label="c.rb" id="graph_8"]
}
}
DOT
Expand All @@ -194,14 +207,36 @@ def build_definition(title: 'title', sources: [])
[
{
id: 'graph_1',
type: 'module',
module_name: 'A',
}, {
id: 'graph_2',
type: 'source',
source_name: 'a.rb',
}, {
id: 'graph_2',
id: 'graph_3',
type: 'dependency',
source_name: 'b.rb',
method_ids: [],
}, {
id: 'graph_4',
type: 'dependency',
source_name: 'c.rb',
method_ids: [],
}, {
id: 'graph_5',
type: 'module',
module_name: 'B',
}, {
id: 'graph_6',
type: 'source',
source_name: 'b.rb',
}, {
id: 'graph_3',
id: 'graph_7',
type: 'module',
module_name: 'B',
}, {
id: 'graph_8',
type: 'source',
source_name: 'c.rb',
},
Expand Down

0 comments on commit 163a6be

Please sign in to comment.