Skip to content

Add dummy app - #7

Closed
RenzoMinelli wants to merge 13 commits into
masterfrom
rm/add-dummy-app
Closed

RenzoMinelli wants to merge 13 commits into
masterfrom
rm/add-dummy-app

Conversation

@RenzoMinelli

@RenzoMinelli RenzoMinelli commented Aug 10, 2025 •

Copy link
Copy Markdown
Contributor

Summary

Add dummy app that will be used to test the gem

@RenzoMinelli
RenzoMinelli force-pushed the rm/add-dummy-app branch 3 times, most recently from 429fc83 to ffa8a36 Compare August 11, 2025 00:47
@RenzoMinelli
RenzoMinelli marked this pull request as ready for review August 11, 2025 00:48

@joaquintomas2003 joaquintomas2003 left a comment

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 think we should add bin/rails in the dummy app, right?

Comment thread spec/dummy/db/schema.rb Outdated
@RenzoMinelli

Copy link
Copy Markdown
Contributor Author

I think we should add bin/rails in the dummy app, right?

Why do you think so? I wasn't thinking the dummy app as an executable rails app. More like an app that allows doing some tests with the models we define there.

@joaquintomas2003

joaquintomas2003 commented Aug 12, 2025 •

Copy link
Copy Markdown
Member

Why do you think so?

I was thinking to be able to run the server, or even run the migrations

Base automatically changed from rm/add-devise-strategy to master August 12, 2025 18:48
@RenzoMinelli

RenzoMinelli commented Aug 13, 2025 •

Copy link
Copy Markdown
Contributor Author

Why do you think so?

I was thinking to be able to run the server, or even run the migrations

Okay I ended up adding a lot more files, I copied the structure from webauthn-rails. Now we can run the server and run the migrations.
Also added some tests to verify that the models in the app got correctly loaded.

@santiagorodriguez96 santiagorodriguez96 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looking great! 🔝

Some small comments in order to keep it moving forward!! 💪

Comment on lines +1 to +4
//= link_tree ../images
//= link_directory ../stylesheets .css
//= link_tree ../../javascript .js
//= link_tree ../../../vendor/javascript .js

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should be able to remove this as we are using propshaft, right?

Comment on lines +1 to +15
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
* files in this directory. Styles in this file should be added after the last require_* statement.
* It is generally better to create a new file per style scope.
*
*= require_tree .
*= require_self
*/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same here!

Suggested change
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
* files in this directory. Styles in this file should be added after the last require_* statement.
* It is generally better to create a new file per style scope.
*
*= require_tree .
*= require_self
*/
/*
* This is a manifest file that'll be compiled into application.css.
*
* With Propshaft, assets are served efficiently without preprocessing steps. You can still include
* application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
* cascading order, meaning styles declared later in the document or manifest will override earlier ones,
* depending on specificity.
*
* Consider organizing styles into separate files for maintainability.
*/

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ahh that makes sense. I wonder why rails plugin new generates an application.css in the dummy app but does not install any gem to manage the asset pipeline 🤔

That said, if we are installing propshaft on this dummy app I think we should use the application.css that comes in a default Rails 8 app, don't you think?

import { Turbo } from "@hotwired/turbo-rails"
import "controllers/application"

Turbo.session.drive = false

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this needed?

<%= csrf_meta_tags %>
<%= csp_meta_tag %>

<%= stylesheet_link_tag "application" %>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As we are using propshaft, we should change this to:

Suggested change
<%= stylesheet_link_tag "application" %>
<%= stylesheet_link_tag :app %>

right?

Comment thread spec/dummy/config/initializers/devise.rb
Comment thread .rspec
@@ -1,3 +1,5 @@
--require rails_helper

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Out of curiosity: why did we need to add this? I think in general only the spec_helper is required on this file 🤔

Comment thread devise-webauthn.gemspec
spec.metadata["rubygems_mfa_required"] = "true"
spec.required_ruby_version = ">= 3.1"

spec.add_development_dependency "byebug"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thoughs about using pry-byebug?

Comment thread devise-webauthn.gemspec
spec.add_development_dependency "rubocop-rspec", "~> 3.6"
spec.add_development_dependency "sqlite3", "~> 2.7"
spec.add_development_dependency "stimulus-rails", "~> 1.3"
spec.add_development_dependency "turbo-rails", "~> 2.0"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Out of curiosity: is turbo-rails needed?

Comment thread .rubocop.yml

Style/NumericLiterals:
Exclude:
- 'spec/dummy/db/schema.rb'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should we exclude this file from the dummy from all Rubocop's cops? Should we exclude all the files of the dummy app from Rubocop's cops?

Comment on lines +4 to +15
it "allows building and saving a passkey" do
user = User.new(email: "test@example.com", password: "password")
passkey = described_class.new(name: "test", external_id: "external_id_123", public_key: "public_key_123",
sign_count: 0, user:)

expect(passkey.save).to be_truthy

passkey.reload

expect(passkey).to be_persisted
end
end

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What are we trying to test here? Seems to me that we are testing ActiveRecord's validations and persistance methods, which feels unnecessary to me.

What do you all think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was simply adding some test to verify that the models were loaded correctly and the database changes worked as well. So simple tests for that

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Makes sense! What do you think about skipping the tests for now and add them as part of a different PR?

@joaquintomas2003

Copy link
Copy Markdown
Member

Should we close this PR in favor of this one: #10?

And open separate PRs for the things that are out of scope :)

@joaquintomas2003
joaquintomas2003 deleted the rm/add-dummy-app branch October 21, 2025 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants