Planting feature specs passing

This commit is contained in:
Brenda Wallace committed 2017-11-01 13:57:49 +13:00
1 parent 54b204c636
commit adf07ce5ef
5 files changed
+14 -20

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
module PlantingsHelper
def display_finished(planting)
if !planting.finished_at.nil?
if planting.finished_at.present?
planting.finished_at
elsif planting.finished
"Yes (no date specified)"
-1
View File
@@ -4,7 +4,6 @@
= render "plantings/progress_bar", status: "not planted", progress: 0
- elsif planting.finished?
= render "plantings/progress_bar", status: 'finished', progress: 100
- elsif planting.finish_predicted_at.nil?
- if show_explanation == true
Progress: Not enough data
+2 -2
View File
@@ -5,7 +5,7 @@
-# haml-lint:disable InlineStyles
%div{ class: "progress-bar progress-bar-#{status}", role: "progressbar", style: "width: #{progress}%" }
- if progress >= 30
#{sprintf '%.2f', progress}%
#{sprintf '%.0f', progress}%
- if progress < 30
#{sprintf '%.2f', progress}%
#{sprintf '%.0f', progress}%
-# haml-lint:enable InlineStyles
+8 -10
View File
@@ -41,16 +41,14 @@
= sunniness
- unless @planting.crop.perennial
- if @planting.finished_at.present?
%dt Finished:
%dd= display_finished(@planting)
-else
%dt Predicted finish:
%dd
- if @planting.planted_at.present?
=@planting.finish_predicted_at
- else
Set planted date to get predictions
%dt Finished:
%dd= display_finished(@planting)
%dt Predicted finish:
%dd
- if @planting.finish_predicted_at.present?
=@planting.finish_predicted_at
- else
Set planted date to get predictions
- if @planting.lifespan.present?
%dt Lifespan:
@@ -92,7 +92,6 @@ feature "Planting a crop", :js, :elasticsearch do
expect(page).to have_content "planting was successfully created"
expect(page).to have_content "Progress: Not enough data"
expect(page).to have_content "Days until maturity: unknown"
end
it "should show that planting is in progress" do
@@ -127,9 +126,8 @@ feature "Planting a crop", :js, :elasticsearch do
end
expect(page).to have_content "planting was successfully created"
expect(page).to have_content "Progress: 100%"
expect(page).to have_content "100%"
expect(page).to have_content "Yes (no date specified)"
expect(page).to have_content "Days until maturity: 0"
end
it "should show that planting is 100% complete (date specified)" do
@@ -146,8 +144,7 @@ feature "Planting a crop", :js, :elasticsearch do
end
expect(page).to have_content "planting was successfully created"
expect(page).to have_content "Progress: 100%"
expect(page).to have_content "Days until maturity: 0"
expect(page).to have_content "100%"
end
end
@@ -232,7 +229,7 @@ feature "Planting a crop", :js, :elasticsearch do
end
expect(page).to have_content "planting was successfully created"
expect(page).to have_content "Finished: Yes (no date specified)"
expect(page).to have_content "Progress: 100%"
expect(page).to have_content "100%"
end
describe "Planting sunniness" do