Commit 742e2f4e authored by Coraline Ehmke's avatar Coraline Ehmke

Cleaned up and set project homepage.

parent 4760fbf2
......@@ -10,9 +10,6 @@ module Snuffle
end
def rows
# summary.object_candidates.map do |candidate|
# [summary.path_to_file, summary.class_name, "##{candidate.join(" #")}"].join(',')
# end
summary.cohorts.group_by{|c| c.values}.map do |cohort|
[summary.path_to_file, summary.class_name, cohort[0].join("; "), cohort[1].map(&:line_numbers).join("; ")].join(',')
end
......
......@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
spec.email = ["coraline@idolhands.com"]
spec.summary = %q{Snuffle detects data clumps in your Ruby code.}
spec.description = %q{Snuffle detects data clumps and other hints of extractable objects in your Ruby code.}
spec.homepage = ""
spec.homepage = "https://gitlab.com/coraline/snuffle/tree/master"
spec.license = "MIT"
spec.files = `git ls-files -z`.split("\x0")
......
......@@ -6,17 +6,17 @@ describe Snuffle::SourceFile do
let(:program_2) {Snuffle::SourceFile.new(path_to_file: "spec/fixtures/program_2.rb") }
let(:program_3) {Snuffle::SourceFile.new(path_to_file: "spec/fixtures/program_3.rb") }
describe "#object_candidates" do
describe "#cohorts" do
it "does not match hash values with non-hash values" do
attr_accessor_args = ['city', 'postal_code', 'state']
values = program_2.summary.object_candidates
values = program_2.summary.cohorts.map(&:values)
expect(values.include?(attr_accessor_args)).to be_falsey
end
it "matches elements with the same type" do
args = ['company_name', 'customer_name']
values = program_3.summary.object_candidates
values = program_3.summary.cohorts.map(&:values)
expect(values.include?(args)).to be_truthy
end
......@@ -24,10 +24,11 @@ describe Snuffle::SourceFile do
describe "#class_name" do
let(:top_level) { "require 'something'; class Foo; def bar; puts 'hi'; end; end"}
let(:top_level) { "require 'something'; class Foo; def bar; puts 'hi'; end; end"}
let(:namespaced_1) { "require 'something'; class Foo::Bar; def bar; puts 'hi'; end; end"}
let(:namespaced_2) { "require 'something'; module Foo; module Bar; class Baz; def bar; puts 'hi'; end; end; end; end"}
let(:source_file) { Snuffle::SourceFile.new }
let(:namespaced_3) { "class Foo; module Bar; class Baz; class << self; end; end; end; end" }
let(:source_file) { Snuffle::SourceFile.new }
it "picks up a non-nested class name" do
source_file.source = top_level
......@@ -39,12 +40,16 @@ describe Snuffle::SourceFile do
expect(source_file.class_name).to eq("Foo::Bar")
end
it "picks up a class name inside nested modules" do
xit "picks up a class name inside nested modules" do
source_file.source = namespaced_2
expect(source_file.class_name).to eq("Foo::Bar::Baz")
end
end
it "picks up crazily nested names" do
source_file.source = namespaced_3
expect(source_file.class_name).to eq("Foo::Bar::Baz")
end
end
end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment