blob: aefbdefa57bf20b5ddde6090a7440c8b7bd00d85 (
plain)
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
require 'spec_helper'
require 'filters/badges'
describe BadgesFilter do
describe '#run' do
let(:content) { nil }
subject(:run) { described_class.new.run(content) }
context 'when <strong>(FREE)</strong> badge' do
let(:content) { '<strong>(FREE)</strong>' }
it 'returns correct HTML' do
expect(run).to eq('<span class="badge-trigger free"></span>')
end
end
context 'when <strong>(PREMIUM)</strong> badge' do
let(:content) { '<strong>(PREMIUM)</strong>' }
it 'returns correct HTML' do
expect(run).to eq('<span class="badge-trigger premium"></span>')
end
end
context 'when <strong>(ULTIMATE)</strong> badge' do
let(:content) { '<strong>(ULTIMATE)</strong>' }
it 'returns correct HTML' do
expect(run).to eq('<span class="badge-trigger ultimate"></span>')
end
end
context 'when <strong>(FREE SELF)</strong> badge' do
let(:content) { '<strong>(FREE SELF)</strong>' }
it 'returns correct HTML' do
expect(run).to eq('<span class="badge-trigger free-self"></span>')
end
end
context 'when <strong>(PREMIUM SELF)</strong> badge' do
let(:content) { '<strong>(PREMIUM SELF)</strong>' }
it 'returns correct HTML' do
expect(run).to eq('<span class="badge-trigger premium-self"></span>')
end
end
context 'when <strong>(ULTIMATE SELF)</strong> badge' do
let(:content) { '<strong>(ULTIMATE SELF)</strong>' }
it 'returns correct HTML' do
expect(run).to eq('<span class="badge-trigger ultimate-self"></span>')
end
end
context 'when <strong>(FREE SAAS)</strong> badge' do
let(:content) { '<strong>(FREE SAAS)</strong>' }
it 'returns correct HTML' do
expect(run).to eq('<span class="badge-trigger free-saas"></span>')
end
end
context 'when <strong>(PREMIUM SAAS)</strong> badge' do
let(:content) { '<strong>(PREMIUM SAAS)</strong>' }
it 'returns correct HTML' do
expect(run).to eq('<span class="badge-trigger premium-saas"></span>')
end
end
context 'when <strong>(ULTIMATE SAAS)</strong> badge' do
let(:content) { '<strong>(ULTIMATE SAAS)</strong>' }
it 'returns correct HTML' do
expect(run).to eq('<span class="badge-trigger ultimate-saas"></span>')
end
end
end
describe '#run_from_markdown' do
let(:content) { nil }
subject(:run_from_markdown) { described_class.new.run_from_markdown(content) }
context 'when **(FREE)** badge' do
let(:content) { '**(FREE)**' }
it 'returns correct HTML' do
expect(run_from_markdown).to eq('<span class="badge-trigger free"></span>')
end
end
context 'when **(PREMIUM)** badge' do
let(:content) { '**(PREMIUM)**' }
it 'returns correct HTML' do
expect(run_from_markdown).to eq('<span class="badge-trigger premium"></span>')
end
end
context 'when **(ULTIMATE)** badge' do
let(:content) { '**(ULTIMATE)**' }
it 'returns correct HTML' do
expect(run_from_markdown).to eq('<span class="badge-trigger ultimate"></span>')
end
end
context 'when **(FREE SELF)** badge' do
let(:content) { '**(FREE SELF)**' }
it 'returns correct HTML' do
expect(run_from_markdown).to eq('<span class="badge-trigger free-self"></span>')
end
end
context 'when **(PREMIUM SELF)** badge' do
let(:content) { '**(PREMIUM SELF)**' }
it 'returns correct HTML' do
expect(run_from_markdown).to eq('<span class="badge-trigger premium-self"></span>')
end
end
context 'when **(ULTIMATE SELF)** badge' do
let(:content) { '**(ULTIMATE SELF)**' }
it 'returns correct HTML' do
expect(run_from_markdown).to eq('<span class="badge-trigger ultimate-self"></span>')
end
end
context 'when **(FREE SAAS)** badge' do
let(:content) { '**(FREE SAAS)**' }
it 'returns correct HTML' do
expect(run_from_markdown).to eq('<span class="badge-trigger free-saas"></span>')
end
end
context 'when **(PREMIUM SAAS)** badge' do
let(:content) { '**(PREMIUM SAAS)**' }
it 'returns correct HTML' do
expect(run_from_markdown).to eq('<span class="badge-trigger premium-saas"></span>')
end
end
context 'when **(ULTIMATE SAAS)** badge' do
let(:content) { '**(ULTIMATE SAAS)**' }
it 'returns correct HTML' do
expect(run_from_markdown).to eq('<span class="badge-trigger ultimate-saas"></span>')
end
end
end
end
|