Skip to content
This repository was archived by the owner on Feb 8, 2026. It is now read-only.

Overhaul Spec Tests#576

Open
MatthewKennedy wants to merge 41 commits intomainfrom
fix/specs
Open

Overhaul Spec Tests#576
MatthewKennedy wants to merge 41 commits intomainfrom
fix/specs

Conversation

@MatthewKennedy
Copy link
Copy Markdown
Contributor

@MatthewKennedy MatthewKennedy commented Dec 26, 2022

  • Ensure locale is set back to :en after tests that change the locale to :fr.
  • Rename log_out to log_out_via_frontend_user_menu to avoid tests on admin side using it by mistake.
  • Update some old tests to modern Rspec syntax.
  • Lint some files (mostly to re-run tests).

Fix Admin Sign Out spec, it was not testing the sign out from the admin side, rather it was logging in, redirecting to the frontend and logging back out again.

Now creates an admin user, logs into the admin, redirects to the admin as expected, and then logs out from the admin UI

@MatthewKennedy MatthewKennedy changed the title Fix failing Specs Fix Failing Specs Dec 27, 2022
@MatthewKennedy MatthewKennedy changed the title Fix Failing Specs Overhaul Spec Tests Dec 28, 2022
Copy link
Copy Markdown
Member

@rafalcymerys rafalcymerys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great PR @MatthewKennedy , thanks for that! 🙌
I just have one comment regarding one method that you removed - I think it should stay as it is, but I'll need your feedback on that.

Comment thread lib/spree/auth/engine.rb
@@frontend_available ||= Gem::Specification.find_all_by_name('spree_frontend').any?
end

def self.api_available?
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is safe to be removed, it's used e.g. in lib/spree/auth/engine.rb:43, to determine whether to load decorators for API classes.

Comment thread lib/spree/auth/engine.rb
end
if Spree::Auth::Engine.backend_available?
Dir.glob(File.join(File.dirname(__FILE__), "../../controllers/backend/*/*/*_decorator*.rb")) do |c|
Dir.glob(File.join(File.dirname(__FILE__), "../../controllers/backend/**/*_decorator*.rb")) do |c|
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants