Repository navigation
Add dummy app #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
108e750
e3b6a66
94eb8ff
67a86f9
1c072f5
ee26c61
78e366a
17b7455
2d363e5
5fb798b
6979782
3ba12b8
7856433
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,3 +9,9 @@ | |
|
|
||
| # rspec failure tracking | ||
| .rspec_status | ||
|
|
||
| /spec/dummy/log/* | ||
| /spec/dummy/tmp/* | ||
| /spec/dummy/storage/* | ||
|
|
||
| .byebug_history | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| --require rails_helper | ||
| --format progress | ||
| --format documentation | ||
|
Comment on lines
+2
to
3
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which one of these two options will be used? Should we remove the one that won't be used? |
||
| --color | ||
| --require spec_helper | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,3 +17,17 @@ Metrics/MethodLength: | |
|
|
||
| Gemspec/DevelopmentDependencies: | ||
| Enabled: false | ||
|
|
||
| RSpec/MultipleExpectations: | ||
| Max: 3 | ||
|
|
||
| RSpec/ExampleLength: | ||
| Max: 20 | ||
|
|
||
| Style/NumericLiterals: | ||
| Exclude: | ||
| - 'spec/dummy/db/schema.rb' | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? |
||
|
|
||
| Style/FrozenStringLiteralComment: | ||
| Exclude: | ||
| - 'spec/dummy/db/schema.rb' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,9 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require "bundler/gem_tasks" | ||
| require "rspec/core/rake_task" | ||
| require "bundler/setup" | ||
|
|
||
| RSpec::Core::RakeTask.new(:spec) | ||
| APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__) | ||
| load "rails/tasks/engine.rake" | ||
| load "rails/tasks/statistics.rake" | ||
|
|
||
| task default: :spec | ||
| require "bundler/gem_tasks" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| #!/usr/bin/env ruby | ||
| # This command will automatically be run when you run "rails" with Rails gems | ||
| # installed from the root of your application. | ||
|
|
||
| ENGINE_ROOT = File.expand_path("..", __dir__) | ||
| ENGINE_PATH = File.expand_path("../lib/devise/webauthn/engine", __dir__) | ||
| APP_PATH = File.expand_path("../spec/dummy/config/application", __dir__) | ||
|
|
||
| # Set up gems listed in the Gemfile. | ||
| ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) | ||
| require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"]) | ||
|
|
||
| require "rails/all" | ||
| require "rails/engine/commands" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,10 +24,19 @@ Gem::Specification.new do |spec| | |
| spec.metadata["rubygems_mfa_required"] = "true" | ||
| spec.required_ruby_version = ">= 3.1" | ||
|
|
||
| spec.add_development_dependency "byebug" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thoughs about using |
||
| spec.add_development_dependency "importmap-rails" | ||
| spec.add_development_dependency "propshaft" | ||
| spec.add_development_dependency "puma" | ||
| spec.add_development_dependency "rails", "~> 8.0" | ||
| spec.add_development_dependency "rspec", "~> 3.13" | ||
| spec.add_development_dependency "rspec-rails", "~> 6.1" | ||
| spec.add_development_dependency "rubocop", "~> 1.79" | ||
| spec.add_development_dependency "rubocop-rails", "~> 2.32" | ||
| 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" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Out of curiosity: is |
||
|
|
||
| spec.add_dependency "devise", "~> 4.9" | ||
| spec.add_dependency "webauthn", "~> 3.0" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| RSpec.describe Passkey do | ||
| 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 | ||
|
Comment on lines
+4
to
+15
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 What do you all think?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| RSpec.describe User do | ||
| it "allows building and saving a user" do | ||
| user = described_class.new(email: "test@example.com", password: "password") | ||
|
|
||
| expect(user.save).to be_truthy | ||
|
|
||
| user.reload | ||
|
|
||
| expect(user).to be_persisted | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| # Add your own tasks in files placed in lib/tasks ending in .rake, | ||
| # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. | ||
|
|
||
| require_relative "config/application" | ||
|
|
||
| Rails.application.load_tasks |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| //= link_tree ../images | ||
| //= link_directory ../stylesheets .css | ||
| //= link_tree ../../javascript .js | ||
| //= link_tree ../../../vendor/javascript .js | ||
|
Comment on lines
+1
to
+4
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should be able to remove this as we are using |
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+15
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here!
Suggested change
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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:
🤔
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahh that makes sense. I wonder why That said, if we are installing |
||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| class ApplicationController < ActionController::Base | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| class HomeController < ApplicationController | ||
| before_action :authenticate_user! | ||
|
|
||
| def index; end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| // Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails | ||
| import { Turbo } from "@hotwired/turbo-rails" | ||
| import "controllers/application" | ||
|
|
||
| Turbo.session.drive = false | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this needed? |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import { Application } from "@hotwired/stimulus" | ||
|
|
||
| const application = Application.start() | ||
|
|
||
| // Configure Stimulus development experience | ||
| application.debug = false | ||
| window.Stimulus = application | ||
|
|
||
| export { application } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| // Import and register all your controllers from the importmap via controllers/**/*_controller | ||
| import { application } from "controllers/application" | ||
| import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading" | ||
| eagerLoadControllersFrom("controllers", application) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| class ApplicationMailer < ActionMailer::Base | ||
| end |
There was a problem hiding this comment.
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_helperis required on this file 🤔