summaryrefslogtreecommitdiff
path: root/spec/models/hooks
diff options
context:
space:
mode:
authorDuana Saskia <starkcoffee@users.noreply.github.com>2018-09-02 01:55:06 +1000
committerDuana Saskia <starkcoffee@users.noreply.github.com>2018-09-05 21:58:52 +1000
commit9d742e61a79dcc85589598259e2fdac030b7ac00 (patch)
treeb1f0b422eeebbc98a52d2003e7ead78fb504afd6 /spec/models/hooks
parentc322976032e45f02b60701ebf244a8a876063078 (diff)
downloadgitlab-ce-9d742e61a79dcc85589598259e2fdac030b7ac00.tar.gz
Refactor: move active hook filter to TriggerableHooks
Diffstat (limited to 'spec/models/hooks')
-rw-r--r--spec/models/hooks/active_hook_filter_spec.rb19
1 files changed, 10 insertions, 9 deletions
diff --git a/spec/models/hooks/active_hook_filter_spec.rb b/spec/models/hooks/active_hook_filter_spec.rb
index c97003eb542..df7edda2213 100644
--- a/spec/models/hooks/active_hook_filter_spec.rb
+++ b/spec/models/hooks/active_hook_filter_spec.rb
@@ -11,28 +11,29 @@ describe ActiveHookFilter do
context 'branch filter is specified' do
let(:branch_filter) { 'master' }
+
it 'returns true if branch matches' do
- expect(filter.matches?(:push_hooks, { ref: 'refs/heads/master' })).to eq(true)
+ expect(filter.matches?(:push_hooks, { ref: 'refs/heads/master' })).to be true
end
it 'returns false if branch does not match' do
- expect(filter.matches?(:push_hooks, { ref: 'refs/heads/my_branch' })).to eq(false)
+ expect(filter.matches?(:push_hooks, { ref: 'refs/heads/my_branch' })).to be false
end
it 'returns false if ref is nil' do
- expect(filter.matches?(:push_hooks, {})).to eq(false)
+ expect(filter.matches?(:push_hooks, {})).to be false
end
context 'branch filter contains wildcard' do
let(:branch_filter) { 'features/*' }
it 'returns true if branch matches' do
- expect(filter.matches?(:push_hooks, { ref: 'refs/heads/features/my-branch' })).to eq(true)
- expect(filter.matches?(:push_hooks, { ref: 'refs/heads/features/my-branch/something' })).to eq(true)
+ expect(filter.matches?(:push_hooks, { ref: 'refs/heads/features/my-branch' })).to be true
+ expect(filter.matches?(:push_hooks, { ref: 'refs/heads/features/my-branch/something' })).to be true
end
it 'returns false if branch does not match' do
- expect(filter.matches?(:push_hooks, { ref: 'refs/heads/master' })).to eq(false)
+ expect(filter.matches?(:push_hooks, { ref: 'refs/heads/master' })).to be false
end
end
end
@@ -41,7 +42,7 @@ describe ActiveHookFilter do
let(:branch_filter) { nil }
it 'returns true' do
- expect(filter.matches?(:push_hooks, { ref: 'refs/heads/master' })).to eq(true)
+ expect(filter.matches?(:push_hooks, { ref: 'refs/heads/master' })).to be true
end
end
@@ -49,7 +50,7 @@ describe ActiveHookFilter do
let(:branch_filter) { '' }
it 'acts like branch is not specified' do
- expect(filter.matches?(:push_hooks, { ref: 'refs/heads/master' })).to eq(true)
+ expect(filter.matches?(:push_hooks, { ref: 'refs/heads/master' })).to be true
end
end
end
@@ -60,7 +61,7 @@ describe ActiveHookFilter do
end
it 'returns true as branch filters are not yet supported for these' do
- expect(filter.matches?(:issues_events, { ref: 'refs/heads/master' })).to eq(true)
+ expect(filter.matches?(:issues_events, { ref: 'refs/heads/master' })).to be true
end
end
end