Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • guard-org/guard
1 result
Show changes
Commits on Source (2)
Loading
Loading
@@ -26,6 +26,13 @@ module Guard
@pattern = Pattern.create(pattern)
end
 
# Compare with other watcher
# @param other [Guard::Watcher] other watcher for comparing
# @return [true, false] equal or not
def ==(other)
action == other.action && pattern == other.pattern
end
# Finds the files that matches a Guard plugin.
#
# @param [Guard::Plugin] guard the Guard plugin which watchers are used
Loading
Loading
Loading
Loading
@@ -2,10 +2,20 @@ module Guard
class Watcher
class Pattern
class Matcher
attr_reader :matcher
def initialize(obj)
@matcher = obj
end
 
# Compare with other matcher
# @param other [Guard::Watcher::Pattern::Matcher]
# other matcher for comparing
# @return [true, false] equal or not
def ==(other)
matcher == other.matcher
end
def match(string_or_pathname)
@matcher.match(normalized(string_or_pathname))
end
Loading
Loading
Loading
Loading
@@ -42,6 +42,18 @@ RSpec.describe Guard::Watcher::Pattern::Matcher do
end
end
 
describe "#==" do
it "returns true for equal matchers" do
expect(described_class.new(/spec_helper\.rb/)).
to eq(described_class.new(/spec_helper\.rb/))
end
it "returns false for unequal matchers" do
expect(described_class.new(/spec_helper\.rb/)).
not_to eq(described_class.new(/spec_helper\.r/))
end
end
describe "integration" do
describe "#match result" do
subject { described_class.new(obj).match(filename) }
Loading
Loading
Loading
Loading
@@ -36,6 +36,18 @@ RSpec.describe Guard::Watcher do
end
end
 
describe "#==" do
it "returns true for equal watchers" do
expect(described_class.new(/spec_helper\.rb/)).
to eq(described_class.new(/spec_helper\.rb/))
end
it "returns false for unequal watchers" do
expect(described_class.new(/spec_helper\.rb/)).
not_to eq(described_class.new(/spec_helper\.r/))
end
end
describe ".match_files" do
let(:plugin) { instance_double("Guard::Plugin", options: {}) }
 
Loading
Loading