|
128 | 128 | expect(dojo_ids).not_to include(@dojo_2021_active.id)
|
129 | 129 | end
|
130 | 130 |
|
| 131 | + it "does not show inactivated styling for dojos active in 2020" do |
| 132 | + get dojos_path(year: 2020, format: :html) |
| 133 | + |
| 134 | + # HTMLレスポンスを取得 |
| 135 | + html = response.body |
| 136 | + |
| 137 | + # 2021年に非アクティブ化された道場(Test Dojo 2020 Inactive)が含まれていることを確認 |
| 138 | + expect(html).to include("Test Dojo 2020 Inactive") |
| 139 | + |
| 140 | + # その道場の行を探す(IDで特定) |
| 141 | + dojo_row_match = html.match(/Test Dojo 2020 Inactive.*?<\/tr>/m) |
| 142 | + expect(dojo_row_match).not_to be_nil |
| 143 | + |
| 144 | + dojo_row = dojo_row_match[0] |
| 145 | + |
| 146 | + # 重要: この道場は2021年3月に非アクティブ化されたが、 |
| 147 | + # 2020年末時点ではアクティブだったので、inactive-item クラスを持たないべき |
| 148 | + # 現在のコードはここで失敗するはず(現在の is_active: false を使っているため) |
| 149 | + expect(dojo_row).not_to include('class="inactive-item"') |
| 150 | + end |
| 151 | + |
131 | 152 | it "filters correctly in CSV format" do
|
132 | 153 | get dojos_path(year: 2020, format: :csv)
|
133 | 154 |
|
|
154 | 175 | expect(dojo_ids).not_to include(@dojo_2020_inactive.id)
|
155 | 176 | expect(dojo_ids).not_to include(@dojo_2019_inactive.id)
|
156 | 177 | end
|
| 178 | + |
| 179 | + it "does not show any inactivated dojos for year 2021" do |
| 180 | + get dojos_path(year: 2021, format: :html) |
| 181 | + |
| 182 | + html = response.body |
| 183 | + |
| 184 | + # 2021年末時点でアクティブな道場のみが含まれる |
| 185 | + expect(html).to include("Test Dojo 2020") # アクティブ |
| 186 | + expect(html).to include("Test Dojo 2021") # アクティブ |
| 187 | + expect(html).to include("Multi Branch Dojo") # アクティブ |
| 188 | + |
| 189 | + # 2021年に非アクティブ化された道場は含まれない |
| 190 | + expect(html).not_to include("Test Dojo 2020 Inactive") |
| 191 | + expect(html).not_to include("Test Dojo 2019 Inactive") |
| 192 | + |
| 193 | + # すべての表示された道場は inactive-item クラスを持たないべき |
| 194 | + # (2021年末時点ではすべてアクティブなので) |
| 195 | + expect(html.scan('class="inactive-item"').count).to eq(0) |
| 196 | + end |
157 | 197 | end
|
158 | 198 | end
|
159 | 199 |
|
|
0 commit comments