Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,9 @@ def sweep_progress_bar(sweep) | |
auto_refresh_type: 'sweep', | ||
auto_refresh_id: sweep.id, | ||
} | ||
content_tag(:div, class: 'progress', | ||
klass = "progress" | ||
klass += " progress-striped active" if sweep.count_pending > 0 | ||
This comment has been minimized.
Sorry, something went wrong. |
||
content_tag(:div, class: klass, | ||
This comment has been minimized.
Sorry, something went wrong.
lencioni
|
||
title: sweep_status(sweep), | ||
data: data_attrs) do | ||
PROGRESS_BAR_STYLE_MAPPINGS.map do |state, bootstrap_class| | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,4 +50,35 @@ | |
it { should == '3 accepted, 2 rejected' } | ||
end | ||
end | ||
|
||
describe '#sweep_progress_bar' do | ||
let(:counts) do | ||
{ | ||
pending: 10, | ||
rejected: 0, | ||
accepted: 0, | ||
under_review: 0, | ||
} | ||
This comment has been minimized.
Sorry, something went wrong.
lencioni
|
||
end | ||
let(:sweep) do | ||
build :sweep, count_rejected: counts[:rejected], | ||
count_pending: counts[:pending], | ||
count_accepted: counts[:accepted], | ||
count_under_review: counts[:under_review] | ||
end | ||
|
||
let(:progress_bar) { sweep_progress_bar sweep } | ||
|
||
context 'with pending snapshots' do | ||
it "should have the progress-striped class" do | ||
This comment has been minimized.
Sorry, something went wrong.
lencioni
|
||
expect(progress_bar[0..44]).to eq '<div class="progress progress-striped active"' | ||
This comment has been minimized.
Sorry, something went wrong.
lencioni
|
||
end | ||
end | ||
context 'with all snapshots completed' do | ||
This comment has been minimized.
Sorry, something went wrong. |
||
it "should only have the progress class" do | ||
counts[:pending] = 0 | ||
expect(progress_bar[0..20]).to eq '<div class="progress"' | ||
end | ||
end | ||
end | ||
end |
This is a style nitpick, but we prefer single quotes unless you need double quotes for string interpolation or if your string has a single quote in it. However, if you take my suggestion below, this becomes irrelevant on this particular bit of code.