@@ -20,11 +20,30 @@ def date_range_picker_select_range(range_name)
2020 let ( :user ) { create ( :user , organization : organization ) }
2121
2222 let! ( :very_old ) { create ( described_class . to_s . underscore . to_sym , date_field . to_sym => Time . zone . local ( 2000 , 7 , 31 ) , :organization => organization ) }
23+ let! ( :two_months_ago ) { create ( described_class . to_s . underscore . to_sym , date_field . to_sym => Time . zone . local ( 2019 , 5 , 31 ) , :organization => organization ) }
2324 let! ( :recent ) { create ( described_class . to_s . underscore . to_sym , date_field . to_sym => Time . zone . local ( 2019 , 7 , 24 ) , :organization => organization ) }
2425 let! ( :today ) { create ( described_class . to_s . underscore . to_sym , date_field . to_sym => Time . zone . local ( 2019 , 7 , 31 ) , :organization => organization ) }
26+ let! ( :one_month_ahead ) { create ( described_class . to_s . underscore . to_sym , date_field . to_sym => Time . zone . local ( 2019 , 8 , 31 ) , :organization => organization ) }
2527 let! ( :one_year_ahead ) { create ( described_class . to_s . underscore . to_sym , date_field . to_sym => Time . zone . local ( 2020 , 7 , 31 ) , :organization => organization ) }
2628 let! ( :two_years_ahead ) { create ( described_class . to_s . underscore . to_sym , date_field . to_sym => Time . zone . local ( 2021 , 7 , 31 ) , :organization => organization ) }
2729
30+ context "when choosing 'Default'" do
31+ before do
32+ sign_out user
33+ travel_to Time . zone . local ( 2019 , 7 , 31 )
34+ sign_in user
35+ end
36+
37+ after do
38+ travel_back
39+ end
40+
41+ it "shows only 4 records" do
42+ visit subject
43+ expect ( page ) . to have_css ( "table tbody tr" , count : 4 )
44+ end
45+ end
46+
2847 context "when choosing 'All Time'" do
2948 before do
3049 sign_out user
@@ -41,7 +60,7 @@ def date_range_picker_select_range(range_name)
4160 date_range = "#{ Time . zone . local ( 1919 , 7 , 1 ) . to_formatted_s ( :date_picker ) } - #{ Time . zone . local ( 2020 , 7 , 31 ) . to_formatted_s ( :date_picker ) } "
4261 fill_in "filters_date_range" , with : date_range
4362 find ( :id , 'filters_date_range' ) . native . send_keys ( :enter )
44- expect ( page ) . to have_css ( "table tbody tr" , count : 4 )
63+ expect ( page ) . to have_css ( "table tbody tr" , count : 6 )
4564 end
4665 end
4766
0 commit comments