diff options
Diffstat (limited to 'spec/models/hooks')
-rw-r--r-- | spec/models/hooks/active_hook_filter_spec.rb | 19 |
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 |