Skip to content

Commit

Permalink
Turn off PATCH test when running test for rails3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
hoppergee committed Jul 28, 2021
1 parent aa45ffa commit 4680972
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
10 changes: 6 additions & 4 deletions spec/integration/breadcrumb_trail_spec.rb
Expand Up @@ -100,10 +100,12 @@
expect(page.html).to include('<a href="/onboard/step/3">Step 3</a>')
end

click_on "Save & Next" # PATCH
expect(page).to have_selector("h1", text: "Step 4")
page.within '#breadcrumbs .selected' do
expect(page.html).to include('<a href="/onboard/step/4">Step 4</a>')
if Rails.version >= '4.0.0'
click_on "Save & Next" # PATCH
expect(page).to have_selector("h1", text: "Step 4")
page.within '#breadcrumbs .selected' do
expect(page.html).to include('<a href="/onboard/step/4">Step 4</a>')
end
end

click_on "Save & Next" # DELETE
Expand Down
14 changes: 7 additions & 7 deletions spec/rails_app/app/controllers/onboard_controller.rb
Expand Up @@ -8,29 +8,29 @@ def setup
when "1"
breadcrumb "Step 1", onboard_step_path(step: 1),
match: :exact, http_verbs: %i[get]
render "step1"
render :step1
when "2"
breadcrumb "Step 2", onboard_step_path(step: 2),
match: :exact, http_verbs: %i[get post]
render "step2"
render :step2
when "3"
breadcrumb "Step 3", onboard_step_path(step: 3),
match: :exact, http_verbs: %i[get put]
render "step3"
render :step3
when "4"
breadcrumb "Step 4", onboard_step_path(step: 4),
match: :exact, http_verbs: %i[get patch]
render "step4"
render :step4
when "5"
breadcrumb "Step 5", onboard_step_path(step: 5),
match: :exact, http_verbs: %i[get delete]
render "step5"
render :step5
when "6"
breadcrumb "Step 6", onboard_step_path(step: 6),
match: :exact, http_verbs: :all
render "step6"
render :step6
else
render "setup"
render :setup
end
end
end
6 changes: 5 additions & 1 deletion spec/rails_app/app/views/onboard/step3.html.erb
@@ -1,2 +1,6 @@
<h1>Step 3</h1>
<%= button_to "Save & Next", onboard_step_path(step: 4), method: :patch %>
<% if Rails.version >= '4.0.0' %>
<%= button_to "Save & Next", onboard_step_path(step: 4), method: :patch %>
<% else %>
<%= button_to "Save & Next", onboard_step_path(step: 5), method: :delete %>
<% end %>
4 changes: 3 additions & 1 deletion spec/rails_app/config/routes.rb
Expand Up @@ -8,7 +8,9 @@
get "/onboard", to: "onboard#setup", as: :onboard
get "/onboard/step/:step", to: "onboard#setup", as: :onboard_step
post "/onboard/step/:step", to: "onboard#setup"
patch "/onboard/step/:step", to: "onboard#setup"
if Rails.version >= "4.0.0"
patch "/onboard/step/:step", to: "onboard#setup"
end
put "/onboard/step/:step", to: "onboard#setup"
delete "/onboard/step/:step", to: "onboard#setup"
end

0 comments on commit 4680972

Please sign in to comment.