-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbmt_spec.rb
More file actions
91 lines (72 loc) · 2.54 KB
/
bmt_spec.rb
File metadata and controls
91 lines (72 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
require 'spec_helper'
describe BMT do
describe '#versions' do
subject { described_class.versions }
# START Contributions by Cursor.
it 'return all of the versions in the filesystem in reverse semver order' do
expect(subject).to eq(['10.0', '2.1', '1.0'])
end
# END Cursor.
end
describe '#current_version' do
subject { described_class.current_version }
it 'return the most recent version number for the vrt' do
expect(subject).to eq('10.0')
end
end
describe '#methodology_keys' do
context 'without specified version' do
subject { described_class.methodology_keys }
it 'returns methodologies for the latest version' do
expect(subject).to match_array(%w[website-testing outback-animal-testing])
end
end
context 'with custom version' do
subject { described_class.methodology_keys(version: '1.0') }
it 'returns methodologies for the specified version' do
expect(subject).to match_array(['website-testing'])
end
end
end
describe '#find' do
context 'without specified version' do
subject(:methodology) { described_class.find(key) }
let(:key) { 'website-testing' }
it 'returns latest version of the methodology' do
expect(methodology).to be_a(BMT::Methodology)
expect(methodology.title).to eq('Bugcrowd Website Testing')
expect(methodology.release_date).to eq(
Date.parse('2021-06-15')
)
end
end
context 'specifing version' do
subject(:methodology) { described_class.find(key, version:) }
let(:key) { 'website-testing' }
context 'with wrong version number' do
let(:version) { '3.0' }
it 'raises VersionNotFoundError' do
expect { subject }.to raise_error BMT::VersionNotFoundError
end
end
context 'with existing version number' do
let(:version) { '1.0' }
context 'and merhodology key not available on that version' do
let(:key) { 'mobile-app-testing' }
it 'raises MethodologyNotFoundError' do
expect { subject }.to raise_error BMT::MethodologyNotFoundError
end
end
context 'and available methodology' do
it 'returns the correct version of the methodology' do
expect(methodology).to be_a(BMT::Methodology)
expect(methodology.title).to eq('Website Testing')
expect(methodology.release_date).to eq(
Date.parse('2021-05-31')
)
end
end
end
end
end
end