Skip to content

Commit

Permalink
Merge pull request #9 from tsabend/f/omit-tests
Browse files Browse the repository at this point in the history
Omit tests from the search
  • Loading branch information
tsabend authored Jan 20, 2017
2 parents c67f574 + 1c70da2 commit 2b97797
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/fus/swift_class.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def initialize(name)
end

def spec?
name.match(/Spec/)
name.match(/Spec|Tests|Test/)
end

def matches_classname?(path)
Expand Down
6 changes: 3 additions & 3 deletions spec/fixtures/FooSpec.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class FooSpec {

}
class FooSpec {}
class FooTest {}
class FooTests {}
4 changes: 2 additions & 2 deletions spec/fus_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
expect(swift_classnames).to include(
"Foo", "ClassVar", "SuperFoo",
"NoSpaceSuperFoo", "UnusedClass",
"ObjCH", "ObjCM", "FooSpec",
"ObjCH", "ObjCM", "FooSpec", "FooTest", "FooTests",
"UsedInStoryboardView", "UsedInStoryboardViewController",
"UsedInXib", "ObjCHForwardDeclarationOnly", "TypeAliasClass", "AssociatedTypeClass"
)
expect(swift_classnames.count).to eq(14)
expect(swift_classnames.count).to eq(16)
end
end

Expand Down
12 changes: 11 additions & 1 deletion spec/swift_class_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,18 @@
spec = Fus::SwiftClass.new("FooSpec")
expect(spec.spec?).to be_truthy
end

it "returns true if the classname ends in Test" do
spec = Fus::SwiftClass.new("FooTest")
expect(spec.spec?).to be_truthy
end

it "returns true if the classname ends in Tests" do
spec = Fus::SwiftClass.new("FooTests")
expect(spec.spec?).to be_truthy
end

it "returns false if the classname doesn't end in Spec" do
it "returns false if the classname doesn't end in Spec, Test or Tests" do
not_spec = Fus::SwiftClass.new("FooBar")
expect(not_spec.spec?).to be_falsy
end
Expand Down

0 comments on commit 2b97797

Please sign in to comment.