Skip to content

Commit

Permalink
Format with rubyfmt, remove standardrb
Browse files Browse the repository at this point in the history
  • Loading branch information
mikker committed Jun 16, 2023
1 parent 973078f commit 7189a25
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 22 deletions.
14 changes: 7 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@

begin
require "bundler/setup"

rescue LoadError
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
puts("You must `gem install bundler` and `bundle install` to run rake tasks")
end

require "yard"

YARD::Rake::YardocTask.new
task docs: :yard
task(docs: :yard)

APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
load "rails/tasks/engine.rake"
load "rails/tasks/statistics.rake"
load("rails/tasks/engine.rake")
load("rails/tasks/statistics.rake")

require "bundler/gem_tasks"

Expand All @@ -24,6 +26,4 @@ Rake::TestTask.new(:test) do |t|
t.verbose = false
end

task default: :test

require "standard/rake"
task(default: :test)
10 changes: 5 additions & 5 deletions lib/generators/passwordless/views_generator.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
require 'rails/generators'
require "rails/generators"

module Passwordless
module Generators
class ViewsGenerator < Rails::Generators::Base
source_root File.expand_path('../../../app/views/passwordless', __dir__)
source_root File.expand_path("../../../app/views/passwordless", __dir__)

def install
copy_file 'mailer/magic_link.text.erb', 'app/views/passwordless/mailer/magic_link.text.erb'
copy_file 'sessions/new.html.erb', 'app/views/passwordless/sessions/new.html.erb'
copy_file 'sessions/create.html.erb', 'app/views/passwordless/sessions/create.html.erb'
copy_file("mailer/magic_link.text.erb", "app/views/passwordless/mailer/magic_link.text.erb")
copy_file("sessions/new.html.erb", "app/views/passwordless/sessions/new.html.erb")
copy_file("sessions/create.html.erb", "app/views/passwordless/sessions/create.html.erb")
end
end
end
Expand Down
26 changes: 17 additions & 9 deletions lib/passwordless/test_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,33 @@ module Passwordless
module TestHelpers
module TestCase
def passwordless_sign_out
delete Passwordless::Engine.routes.url_helpers.sign_out_path
delete(Passwordless::Engine.routes.url_helpers.sign_out_path)
follow_redirect!
end

def passwordless_sign_in(resource)
session = Passwordless::Session.create!(authenticatable: resource, user_agent: "TestAgent", remote_addr: "unknown")
get Passwordless::Engine.routes.url_helpers.token_sign_in_path(session.token)
session = Passwordless::Session.create!(
authenticatable: resource,
user_agent: "TestAgent",
remote_addr: "unknown"
)
get(Passwordless::Engine.routes.url_helpers.token_sign_in_path(session.token))
follow_redirect!
end
end

module SystemTestCase
def passwordless_sign_out
visit Passwordless::Engine.routes.url_helpers.sign_out_path
visit(Passwordless::Engine.routes.url_helpers.sign_out_path)
end

def passwordless_sign_in(resource)
session = Passwordless::Session.create!(authenticatable: resource, user_agent: "TestAgent", remote_addr: "unknown")
visit Passwordless::Engine.routes.url_helpers.token_sign_in_path(session.token)
session = Passwordless::Session.create!(
authenticatable: resource,
user_agent: "TestAgent",
remote_addr: "unknown"
)
visit(Passwordless::Engine.routes.url_helpers.token_sign_in_path(session.token))
end
end
end
Expand All @@ -36,8 +44,8 @@ def passwordless_sign_in(resource)

if defined?(RSpec)
RSpec.configure do |config|
config.include ::Passwordless::TestHelpers::TestCase, type: :request
config.include ::Passwordless::TestHelpers::TestCase, type: :controller
config.include ::Passwordless::TestHelpers::SystemTestCase, type: :system
config.include(::Passwordless::TestHelpers::TestCase, type: :request)
config.include(::Passwordless::TestHelpers::TestCase, type: :controller)
config.include(::Passwordless::TestHelpers::SystemTestCase, type: :system)
end
end
1 change: 0 additions & 1 deletion passwordless.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@ Gem::Specification.new do |s|

s.add_development_dependency("sqlite3")
s.add_development_dependency("yard")
s.add_development_dependency("standard")
s.add_development_dependency("minitest")
end

0 comments on commit 7189a25

Please sign in to comment.