Skip to content

Commit

Permalink
Fixing regression on APIPart templates
Browse files Browse the repository at this point in the history
Error occured when an authenticated user would open non authenticated
APIPart pages
  • Loading branch information
Un3x committed Dec 5, 2023
1 parent 7ccd842 commit 97bafe0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
6 changes: 6 additions & 0 deletions app/controllers/api_particulier_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@ class APIParticulierController < ApplicationController
def namespace
'api_particulier'
end

helper_method :tokens_to_export?

def tokens_to_export?
false
end
end
20 changes: 17 additions & 3 deletions spec/features/api_particulier/faq_spec.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
require 'rails_helper'

RSpec.describe 'FAQ & Support', app: :api_particulier do
before do
it 'displays entries' do
visit faq_index_path
end

it 'displays entries' do
expect(page).to have_css('.faq-entry', count: APIParticulier::FAQEntry.all.count)
end

it 'has a button to copy anchors on titles', :js do
visit faq_index_path

APIParticulier::FAQEntry.all do |entry|
expect(page).to have_css("#button-anchor-#{entry.category.parameterize}"),
"Missing button copy-anchor on #{entry.category}"
end
end

describe 'non regression test' do
let!(:user) { create(:user) }

before do
login_as(user)
end

it 'displays the page' do
visit faq_index_path

expect(page).to have_http_status(:success)
end
end
end

0 comments on commit 97bafe0

Please sign in to comment.