mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-08-07 05:13:37 -04:00
Avoid time travel in favour of calculating a number of past/future dates
This commit is contained in:
1 parent
3644a8124f
commit
82553d6e0a
1 file changed
+11
-8
@@ -53,16 +53,19 @@ feature "Planting a crop", :js do
|
||||
|
||||
describe "Progress bar status on planting creation" do
|
||||
before do
|
||||
DateTime.stub(:now) { DateTime.new(2015, 10, 20, 10, 34) }
|
||||
login_as member
|
||||
visit new_planting_path
|
||||
|
||||
@a_past_date = 15.days.ago.strftime("%Y-%m-%d")
|
||||
@right_now = Date.today.strftime("%Y-%m-%d")
|
||||
@a_future_date = 1.years.from_now.strftime("%Y-%m-%d")
|
||||
end
|
||||
|
||||
it "should show that it is not planted yet" do
|
||||
fill_autocomplete "crop", with: "mai"
|
||||
select_from_autocomplete "maize"
|
||||
within "form#new_planting" do
|
||||
fill_in "When", with: "2015-12-15"
|
||||
fill_in "When", with: @a_future_date
|
||||
fill_in "How many?", with: 42
|
||||
select "cutting", from: "Planted from:"
|
||||
select "semi-shade", from: "Sun or shade?"
|
||||
@@ -78,7 +81,7 @@ feature "Planting a crop", :js do
|
||||
fill_autocomplete "crop", with: "mai"
|
||||
select_from_autocomplete "maize"
|
||||
within "form#new_planting" do
|
||||
fill_in "When", with: "2015-9-15"
|
||||
fill_in "When", with: @a_past_date
|
||||
fill_in "How many?", with: 42
|
||||
select "cutting", from: "Planted from:"
|
||||
select "semi-shade", from: "Sun or shade?"
|
||||
@@ -95,12 +98,12 @@ feature "Planting a crop", :js do
|
||||
fill_autocomplete "crop", with: "mai"
|
||||
select_from_autocomplete "maize"
|
||||
within "form#new_planting" do
|
||||
fill_in "When", with: "2015-10-15"
|
||||
fill_in "When", with: @right_now
|
||||
fill_in "How many?", with: 42
|
||||
select "cutting", from: "Planted from:"
|
||||
select "semi-shade", from: "Sun or shade?"
|
||||
fill_in "Tell us more about it", with: "It's rad."
|
||||
fill_in "Finished date", with: "2015-10-30"
|
||||
fill_in "Finished date", with: @a_future_date
|
||||
click_button "Save"
|
||||
end
|
||||
|
||||
@@ -113,7 +116,7 @@ feature "Planting a crop", :js do
|
||||
fill_autocomplete "crop", with: "mai"
|
||||
select_from_autocomplete "maize"
|
||||
within "form#new_planting" do
|
||||
fill_in "When", with: "2015-10-15"
|
||||
fill_in "When", with: @right_now
|
||||
fill_in "How many?", with: 42
|
||||
select "cutting", from: "Planted from:"
|
||||
select "semi-shade", from: "Sun or shade?"
|
||||
@@ -132,12 +135,12 @@ feature "Planting a crop", :js do
|
||||
fill_autocomplete "crop", with: "mai"
|
||||
select_from_autocomplete "maize"
|
||||
within "form#new_planting" do
|
||||
fill_in "When", with: "2015-10-15"
|
||||
fill_in "When", with: @a_past_date
|
||||
fill_in "How many?", with: 42
|
||||
select "cutting", from: "Planted from:"
|
||||
select "semi-shade", from: "Sun or shade?"
|
||||
fill_in "Tell us more about it", with: "It's rad."
|
||||
fill_in "Finished date", with: "2015-10-19"
|
||||
fill_in "Finished date", with: @right_now
|
||||
click_button "Save"
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user