1515
1616 expect ( response ) . to be_ok
1717 end
18-
19- context "showing the right states" do
20- let ( :last_year_state_name ) { "state that was open last year but not this year" }
21- let ( :continuing_state_name ) { "state that was open last year and open this year" }
22- let ( :new_this_year_state_name ) { "new state that will open this year" }
23- let ( :new_next_year_state_name ) { "new state that will open next year" }
24- before do
25- allow ( StateFile ::StateInformationService ) . to receive ( :filing_years ) . with ( :last_year_state ) . and_return ( [ tax_year - 1 ] )
26- allow ( StateFile ::StateInformationService ) . to receive ( :filing_years ) . with ( :continuing_state ) . and_return ( [ tax_year + 1 , tax_year , tax_year - 1 ] )
27- allow ( StateFile ::StateInformationService ) . to receive ( :filing_years ) . with ( :new_this_year_state ) . and_return ( [ tax_year , tax_year + 1 ] )
28- allow ( StateFile ::StateInformationService ) . to receive ( :filing_years ) . with ( :new_next_year_state ) . and_return ( [ tax_year + 1 ] )
29-
30- allow ( StateFile ::StateInformationService ) . to receive ( :state_code_to_name_map ) . and_return (
31- {
32- last_year_state : last_year_state_name ,
33- continuing_state : continuing_state_name ,
34- new_this_year_state : new_this_year_state_name ,
35- new_next_year_state : new_next_year_state_name ,
36- }
37- )
38- end
39-
40- context "when FYST has not opened yet for the year" do
41- around do |example |
42- Timecop . freeze ( Rails . configuration . state_file_show_faq_date_start - 1 . hour ) do
43- example . run
44- end
45- end
46-
47- context "in production" do
48- before do
49- allow ( Rails ) . to receive ( :env ) . and_return ( "production" . inquiry )
50- end
51-
52- it "shows only states that were open before and will reopen" do
53- get :index , params : { us_state : "us" }
54-
55- expect ( response . body ) . not_to have_text I18n . t ( "state_file.faq.index.title" , state : last_year_state_name )
56- expect ( response . body ) . to have_text I18n . t ( "state_file.faq.index.title" , state : continuing_state_name )
57- expect ( response . body ) . not_to have_text I18n . t ( "state_file.faq.index.title" , state : new_this_year_state_name )
58- expect ( response . body ) . not_to have_text I18n . t ( "state_file.faq.index.title" , state : new_next_year_state_name )
59- end
60- end
61-
62- context "in any other environment" do
63- [ "demo" , "heroku" , "development" ] . each do |environment |
64- before do
65- allow ( Rails ) . to receive ( :env ) . and_return ( environment . inquiry )
66- end
67-
68- it "shows states that will open this season" do
69- get :index , params : { us_state : "us" }
70-
71- expect ( response . body ) . not_to have_text I18n . t ( "state_file.faq.index.title" , state : last_year_state_name )
72- expect ( response . body ) . to have_text I18n . t ( "state_file.faq.index.title" , state : continuing_state_name )
73- expect ( response . body ) . to have_text I18n . t ( "state_file.faq.index.title" , state : new_this_year_state_name )
74- expect ( response . body ) . not_to have_text I18n . t ( "state_file.faq.index.title" , state : new_next_year_state_name )
75- end
76- end
77- end
78- end
79-
80- context "when FYST is either open or has closed for the year" do
81- context "open" do
82- around do |example |
83- Timecop . freeze ( Rails . configuration . state_file_show_faq_date_end - 1 . day ) do
84- example . run
85- end
86- end
87-
88- context "in any environment" do
89- [ "production" , "demo" , "heroku" , "development" ] . each do |environment |
90- before do
91- allow ( Rails ) . to receive ( :env ) . and_return ( environment . inquiry )
92- end
93-
94- it "shows states that are currently open" do
95- get :index , params : { us_state : "us" }
96-
97- expect ( response . body ) . not_to have_text I18n . t ( "state_file.faq.index.title" , state : last_year_state_name )
98- expect ( response . body ) . to have_text I18n . t ( "state_file.faq.index.title" , state : continuing_state_name )
99- expect ( response . body ) . to have_text I18n . t ( "state_file.faq.index.title" , state : new_this_year_state_name )
100- expect ( response . body ) . not_to have_text I18n . t ( "state_file.faq.index.title" , state : new_next_year_state_name )
101- end
102- end
103- end
104- end
105-
106- context "after close" do
107- around do |example |
108- Timecop . freeze ( Rails . configuration . state_file_end_of_in_progress_intakes + 1 . day ) do
109- example . run
110- end
111- end
112-
113- context "in production" do
114- before do
115- allow ( Rails ) . to receive ( :env ) . and_return ( "production" . inquiry )
116- end
117-
118- it "shows only states that were open before and will reopen" do
119- get :index , params : { us_state : "us" }
120-
121- expect ( response . body ) . not_to have_text I18n . t ( "state_file.faq.index.title" , state : last_year_state_name )
122- expect ( response . body ) . to have_text I18n . t ( "state_file.faq.index.title" , state : continuing_state_name )
123- expect ( response . body ) . to have_text I18n . t ( "state_file.faq.index.title" , state : new_this_year_state_name )
124- expect ( response . body ) . not_to have_text I18n . t ( "state_file.faq.index.title" , state : new_next_year_state_name )
125- end
126- end
127-
128- context "in any other environment" do
129- [ "demo" , "heroku" , "development" ] . each do |environment |
130- before do
131- allow ( Rails ) . to receive ( :env ) . and_return ( environment . inquiry )
132- end
133-
134- it "shows states that will open next season" do
135- get :index , params : { us_state : "us" }
136-
137- expect ( response . body ) . not_to have_text I18n . t ( "state_file.faq.index.title" , state : last_year_state_name )
138- expect ( response . body ) . to have_text I18n . t ( "state_file.faq.index.title" , state : continuing_state_name )
139- expect ( response . body ) . to have_text I18n . t ( "state_file.faq.index.title" , state : new_this_year_state_name )
140- expect ( response . body ) . to have_text I18n . t ( "state_file.faq.index.title" , state : new_next_year_state_name )
141- end
142- end
143- end
144- end
145- end
146- end
14718 end
14819
14920 describe "#show" do
15526
15627 expect ( response . body ) . to have_text faq_category . description_en
15728 end
158-
159- context "for new york" do
160- let! ( :faq_category ) { create :faq_category , slug : section_key , product_type : "state_file_ny" }
161-
162- it "redirects to the ny landing page" do
163- get :show , params : { section_key : section_key , us_state : "ny" }
164-
165- expect ( response ) . to redirect_to state_landing_page_path ( us_state : "ny" )
166- end
167- end
16829 end
169- end
30+ end
0 commit comments