|
2 | 2 |
|
3 | 3 | RSpec.describe Web::Views::Vacancies::Index, type: :view do |
4 | 4 | let(:params) { Hash[] } |
5 | | - let(:exposures) { Hash[format: :html, flash: {}, vacancies: [], params: params] } |
| 5 | + let(:search_query) { Hash[] } |
| 6 | + let(:exposures) { Hash[format: :html, flash: {}, params: params, vacancies: [], search_query: search_query] } |
6 | 7 | let(:template) { Hanami::View::Template.new('apps/web/templates/vacancies/index.html.slim') } |
7 | 8 | let(:view) { described_class.new(template, exposures) } |
8 | 9 | let(:rendered) { view.render } |
|
20 | 21 | expect(rendered).to include without_indentation <<~HTML |
21 | 22 | <div class="btn-group btn-group-toggle"> |
22 | 23 | <a class="btn btn-light active"><span>Любые</span></a> |
23 | | - <a class="btn btn-light" href="/?remote=true"><span>Удаленные</span></a> |
24 | | - <a class="btn btn-light" href="/?remote=false"><span>В офисе</span></a> |
| 24 | + <a class="btn btn-light" href="/?query=remote%3Atrue"><span>Удаленные</span></a> |
| 25 | + <a class="btn btn-light" href="/?query=remote%3Afalse"><span>В офисе</span></a> |
25 | 26 | </div> |
26 | 27 | HTML |
27 | 28 | end |
28 | 29 |
|
29 | 30 | context 'when remote is true' do |
30 | | - let(:params) { Hash[remote: 'true'] } |
| 31 | + let(:search_query) { Hash[remote: 'true'] } |
31 | 32 |
|
32 | 33 | it do |
33 | 34 | expect(rendered).to include without_indentation <<~HTML |
34 | 35 | <div class="btn-group btn-group-toggle"> |
35 | 36 | <a class="btn btn-light" href="/"><span>Любые</span></a> |
36 | 37 | <a class="btn btn-light active"><span>Удаленные</span></a> |
37 | | - <a class="btn btn-light" href="/?remote=false"><span>В офисе</span></a> |
| 38 | + <a class="btn btn-light" href="/?query=remote%3Afalse"><span>В офисе</span></a> |
38 | 39 | </div> |
39 | 40 | HTML |
40 | 41 | end |
41 | 42 | end |
42 | 43 |
|
43 | 44 | context 'when remote is false' do |
44 | | - let(:params) { Hash[remote: 'false'] } |
| 45 | + let(:search_query) { Hash[remote: 'false'] } |
45 | 46 |
|
46 | 47 | it do |
47 | 48 | expect(rendered).to include without_indentation <<~HTML |
48 | 49 | <div class="btn-group btn-group-toggle"> |
49 | 50 | <a class="btn btn-light" href="/"><span>Любые</span></a> |
50 | | - <a class="btn btn-light" href="/?remote=true"><span>Удаленные</span></a> |
| 51 | + <a class="btn btn-light" href="/?query=remote%3Atrue"><span>Удаленные</span></a> |
51 | 52 | <a class="btn btn-light active"><span>В офисе</span></a> |
52 | 53 | </div> |
53 | 54 | HTML |
54 | 55 | end |
55 | 56 | end |
56 | 57 |
|
57 | 58 | context 'when remote is not valid' do |
58 | | - let(:params) { Hash[remote: 'foo'] } |
| 59 | + let(:search_query) { Hash[remote: 'foo'] } |
59 | 60 |
|
60 | 61 | it do |
61 | 62 | expect(rendered).to include without_indentation <<~HTML |
62 | 63 | <div class="btn-group btn-group-toggle"> |
63 | 64 | <a class="btn btn-light active"><span>Любые</span></a> |
64 | | - <a class="btn btn-light" href="/?remote=true"><span>Удаленные</span></a> |
65 | | - <a class="btn btn-light" href="/?remote=false"><span>В офисе</span></a> |
| 65 | + <a class="btn btn-light" href="/?query=remote%3Atrue"><span>Удаленные</span></a> |
| 66 | + <a class="btn btn-light" href="/?query=remote%3Afalse"><span>В офисе</span></a> |
66 | 67 | </div> |
67 | 68 | HTML |
68 | 69 | end |
|
0 commit comments