Repository navigation
Add dummy app - #7
RenzoMinelli wants to merge 13 commits into
Conversation
429fc83 to
ffa8a36
Compare
joaquintomas2003
left a comment
There was a problem hiding this comment.
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. |
ffa8a36 to
41d58b6
Compare
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. |
76384ec to
1c072f5
Compare
``` bundle config set force_ruby_platform true bundle install ```
santiagorodriguez96
left a comment
There was a problem hiding this comment.
Looking great! 🔝
Some small comments in order to keep it moving forward!! 💪
| //= link_tree ../images | ||
| //= link_directory ../stylesheets .css | ||
| //= link_tree ../../javascript .js | ||
| //= link_tree ../../../vendor/javascript .js |
There was a problem hiding this comment.
We should be able to remove this as we are using propshaft, right?
| /* | ||
| * 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 | ||
| */ |
There was a problem hiding this comment.
Same here!
| /* | |
| * 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. | |
| */ |
There was a problem hiding this comment.
creating a new plugin I see that the dummy app has an application.css like the one we have now.
Looking into the generators I see there's a difference between the template for the app and the template for the plugin:
- https://github.com/rails/rails/blob/cf6ff17e9a3c6c1139040b519a341f55f0be16cf/railties/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css.tt
- https://github.com/rails/rails/blob/41f4e981ded1c0d8c2b3bc5bff5fb2af38da04ed/railties/lib/rails/generators/rails/plugin/templates/rails/stylesheets.css
- https://github.com/rails/rails/blob/41f4e981ded1c0d8c2b3bc5bff5fb2af38da04ed/railties/lib/rails/generators/rails/plugin/plugin_generator.rb#L155-L157
🤔
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Is this needed?
| <%= csrf_meta_tags %> | ||
| <%= csp_meta_tag %> | ||
|
|
||
| <%= stylesheet_link_tag "application" %> |
There was a problem hiding this comment.
As we are using propshaft, we should change this to:
| <%= stylesheet_link_tag "application" %> | |
| <%= stylesheet_link_tag :app %> |
right?
| @@ -1,3 +1,5 @@ | |||
| --require rails_helper | |||
There was a problem hiding this comment.
Out of curiosity: why did we need to add this? I think in general only the spec_helper is required on this file 🤔
| spec.metadata["rubygems_mfa_required"] = "true" | ||
| spec.required_ruby_version = ">= 3.1" | ||
|
|
||
| spec.add_development_dependency "byebug" |
There was a problem hiding this comment.
Thoughs about using pry-byebug?
| 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" |
There was a problem hiding this comment.
Out of curiosity: is turbo-rails needed?
|
|
||
| Style/NumericLiterals: | ||
| Exclude: | ||
| - 'spec/dummy/db/schema.rb' |
There was a problem hiding this comment.
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?
| 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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Makes sense! What do you think about skipping the tests for now and add them as part of a different PR?
|
Should we close this PR in favor of this one: #10? And open separate PRs for the things that are out of scope :) |
Summary
Add dummy app that will be used to test the gem