source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4_with_engines/engines/user_removal/config/routes.rb
Ruby
mit
47
master
1,935
Rails32::Application.routes.draw do resources :users do get 'mixed_in' end match 'remove' => 'removal#remove_this_too' match 'implicit' => 'removal#implicit_render' # The priority is based upon order of creation: # first created -> highest priority. # Sample of regular route: # match 'product...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4_with_engines/engines/user_removal/app/models/user.rb
Ruby
mit
47
master
206
class User < ActiveRecord::Base attr_accessible :bio, :name, :account_id, :admin, :status_id accepts_nested_attributes_for :something, allow_destroy: false, reject_if: proc { |attributes| stuff } end
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4_with_engines/engines/user_removal/app/controllers/users_controller.rb
Ruby
mit
47
master
2,052
class UsersController < ApplicationController include UserControllerMixin # GET /users # GET /users.json def index @users = User.all respond_to do |format| format.html # index.html.erb format.json { render :json => @users } end end # GET /users/1 # GET /users/1.json def show ...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.1/Gemfile
Ruby
mit
47
master
546
source 'http://rubygems.org' gem 'rails', '3.1.0' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'mysql' gem 'json' gem 'therubyracer' gem 'draper' # Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-ra...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.1/Rakefile
Ruby
mit
47
master
272
#!/usr/bin/env rake # 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 File.expand_path('../config/application', __FILE__) Rails31::Application.load_tasks
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.1/app/models/account.rb
Ruby
mit
47
master
337
class Account < ActiveRecord::Base validates :username, :length => 6..20, :format => /([a-z][0-9])+/i validates :phone, :format => { :with => /(\d{3})-(\d{3})-(\d{4})/, :on => :create }, :presence => true validates :first_name, :format => /\w+/ serialize :cc_info #safe from CVE-2013-0277 attr_accessible :bla...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.1/app/models/user.rb
Ruby
mit
47
master
1,798
class User < ActiveRecord::Base attr_accessible :name scope :tall, lambda {|*args| where("height > '#{User.average_height}'") } scope :blah, where("thinger = '#{BLAH}'") #No longer warns on constants scope :dah, lambda {|*args| { :conditions => "dah = '#{args[1]}'"}} scope :phooey, :conditions => "phoee...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.1/app/models/product.rb
Ruby
mit
47
master
5,685
class Product < ActiveRecord::Base def test_find_order #Should warn, no escaping done for :order Product.find(:all, :order => params[:order]) Product.find(:all, :conditions => 'admin = 1', :order => "name #{params[:order]}") end def test_find_group #Should warn, no escaping done for :group Pr...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.1/app/controllers/other_controller.rb
Ruby
mit
47
master
1,286
class OtherController < ApplicationController def a @a = params[:bad] end def b @b = params[:bad] end def c @c = params[:bad] end def d @d = params[:bad] end def e @e = params[:bad] end def f @f = params[:bad] end def g @g = params[:bad] end def test_part...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.1/app/controllers/admin_controller.rb
Ruby
mit
47
master
1,422
class AdminController < ApplicationController #Examples of skipping important filters with a blacklist instead of whitelist skip_before_filter :login_required, :except => :do_admin_stuff skip_filter :authenticate_user!, :except => :do_admin_stuff skip_before_filter :require_user, :except => [:do_admin_stuff, :d...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.1/app/controllers/users_controller.rb
Ruby
mit
47
master
4,886
class UsersController < ApplicationController PASSWORD = "superdupersecret" http_basic_authenticate_with :name => "superduperadmin", :password => PASSWORD, :only => :create # GET /users # GET /users.json def index @users = User.all respond_to do |format| format.html # index.html.erb f...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.1/app/controllers/mixins/user_mixin.rb
Ruby
mit
47
master
386
module UserMixin #Test mixin action method with explicit template def mixin_action @dangerous_input = params[:bad] render 'users/mixin_template' end #Test mixin action method with default template def mixin_default @dangerous_input = params[:bad] end def assign_if @value = if something ...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.1/config/routes.rb
Ruby
mit
47
master
2,437
Rails31::Application.routes.draw do resources :users match 'users/test_simple_helper' => "users#test_simple_helper" match 'users/test_less_simple_helpers' => "users#test_less_simple_helpers" match 'users/test_less_simple_helpers' => "users#test_assign_twice" resources :users do get 'mixin_action' get...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.1/config/application.rb
Ruby
mit
47
master
2,140
require File.expand_path('../boot', __FILE__) require 'rails/all' if defined?(Bundler) # If you precompile assets before deploying to production, use this line Bundler.require *Rails.groups(:assets => %w(development test)) # If you want your assets lazily compiled in production, use this line # Bundler.requir...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.1/config/environments/production.rb
Ruby
mit
47
master
2,155
Rails31::Application.configure do # Settings specified here will take precedence over those in config/application.rb # Code is not reloaded between requests config.cache_classes = true # Full error reports are disabled and caching is turned on config.consider_all_requests_local = false config.action...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.1/config/environments/development.rb
Ruby
mit
47
master
1,072
Rails31::Application.configure do # Settings specified here will take precedence over those in config/application.rb # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web s...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.1/config/environments/test.rb
Ruby
mit
47
master
1,812
Rails31::Application.configure do # Settings specified here will take precedence over those in config/application.rb # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test ...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.1/config/initializers/secret_token.rb
Ruby
mit
47
master
498
# Be sure to restart your server when you modify this file. # Your secret key for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attac...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.1/config/initializers/session_store.rb
Ruby
mit
47
master
417
# Be sure to restart your server when you modify this file. Rails31::Application.config.session_store :cookie_store, :key => '_rails3.1_session' # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information # (create the session table with "rai...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.1/db/migrate/20110908172338_create_users.rb
Ruby
mit
47
master
235
class CreateUsers < ActiveRecord::Migration def change create_table :users do |t| t.string :name t.string :bio t.string :password t.string :email t.string :role t.timestamps end end end
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.1/test/functional/users_controller_test.rb
Ruby
mit
47
master
1,027
require 'test_helper' class UsersControllerTest < ActionController::TestCase setup do @user = users(:one) end test "should get index" do get :index assert_response :success assert_not_nil assigns(:users) end test "should get new" do get :new assert_response :success end test "s...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/pager.rb
Ruby
mit
47
master
1,640
require_relative '../test' require "railroader/report/pager" class ReportPagerTests < Minitest::Test def setup @@text ||= "Here is some text for your tests\n" * 100 end def test_no_pager out = StringIO.new pager = Railroader::Pager.new(nil, :none, out) pager.page_output(@@text) assert_equa...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/rescanner.rb
Ruby
mit
47
master
6,767
require_relative '../test' require 'tmpdir' require 'railroader/rescanner' class Railroader::Rescanner #For access to internals attr_reader :changes, :reindex end class RescannerTests < Minitest::Test include RailroaderTester::RescanTestHelper def test_no_change_no_warnings before_rescan_of [] asser...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/options.rb
Ruby
mit
47
master
11,691
require_relative '../test' require 'railroader/options' class RailroaderOptionsTest < Minitest::Test EASY_OPTION_INPUTS = { :exit_on_warn => "-z", :exit_on_error => "--exit-on-error", :rails3 => "-3", :run_all_checks => "-A", :assume_all_routes => "...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/rails32.rb
Ruby
mit
47
master
15,364
# NOTE: Please do not add any further tests to the Rails 3.2 application unless # the issue being tested specifically applies to Rails 3.2 and not the other # versions. # If possible, please use the rails5 app. require_relative '../test' class Rails32Tests < Minitest::Test include RailroaderTester::FindWarning i...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/constants.rb
Ruby
mit
47
master
3,541
require_relative '../test' class ConstantTests < Minitest::Test def setup @constants = Railroader::Constants.new end def assert_alias expected, original, full = false tracker = Railroader::Tracker.new(nil) original_sexp = Railroader::BaseProcessor.new(tracker).process(RubyParser.new.parse original) ...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/report_generation.rb
Ruby
mit
47
master
3,044
require 'json' require_relative '../test' class TestReportGeneration < Minitest::Test def setup @@tracker||= Railroader.run(:app_path => "#{TEST_PATH}/apps/rails4", :quiet => true, :report_routes => true) @@report ||= @@tracker.report end def test_html_sanity report = @@report.to_html assert re...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/rails31.rb
Ruby
mit
47
master
43,864
require_relative '../test' class Rails31Tests < Minitest::Test include RailroaderTester::FindWarning include RailroaderTester::CheckExpected def report @@report ||= RailroaderTester.run_scan "rails3.1", "Rails 3.1", :rails3 => true, :parallel_checks => false, :interprocedural => true end def expected ...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/tabs_output.rb
Ruby
mit
47
master
482
require_relative '../test' class TestTabsOutput < Minitest::Test def setup @@report ||= Railroader.run( :app_path => "#{TEST_PATH}/apps/rails2", :quiet => true, :run_all_checks => true ).report.to_tabs end def test_reported_warnings skip 'Temporarily disable test' ...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/parser_timeout.rb
Ruby
mit
47
master
606
require_relative '../test' require 'railroader/rescanner' class ParserTimeoutTests < Minitest::Test include RailroaderTester::RescanTestHelper def test_timeout before_rescan_of "lib/large_file.rb", "rails5.2", { parser_timeout: 1 } do random_ruby = Array.new(10000) { "def x_#{rand(1000)}\nputs '#{"**" *...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/rails52.rb
Ruby
mit
47
master
12,823
require_relative '../test' class Rails52Tests < Minitest::Test include RailroaderTester::FindWarning include RailroaderTester::CheckExpected def report @@report ||= RailroaderTester.run_scan "rails5.2", "Rails 5.2", run_all_checks: true end def expected @@expected ||= { :controller => 0, ...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/codeclimate_output.rb
Ruby
mit
47
master
1,155
require_relative '../test' class TestCodeClimateOutput < Minitest::Test def setup @@report ||= Railroader.run("#{TEST_PATH}/apps/rails2").report.to_codeclimate @@issues ||= @@report.split("\0").map { |json| JSON.parse(json) } end def test_for_expected_keys expected = ["type", "check_name", "descript...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/differ.rb
Ruby
mit
47
master
2,329
require_relative '../test' require 'railroader/differ' class DifferTests < Minitest::Test include RailroaderTester::DiffHelper def setup @@diffrun ||= Railroader.run :app_path => "#{TEST_PATH}/apps/rails2" @warnings ||= @@diffrun.warnings end def diff new, old @diff = Railroader::Differ.new(new, ...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/json_compare.rb
Ruby
mit
47
master
844
require_relative '../test' require 'json' class JSONCompareTests < Minitest::Test include RailroaderTester::DiffHelper def setup @path = File.expand_path "#{TEST_PATH}/apps/rails3.2" @json_path = File.join @path, "doesnt_exist", "report.json" teardown # just to be sure Railroader.run :app_path => ...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/markdown_output.rb
Ruby
mit
47
master
491
require_relative '../test' class TestMarkdownOutput < Minitest::Test def setup @@report ||= Railroader.run( :app_path => "#{TEST_PATH}/apps/rails2", :quiet => true, :run_all_checks => true ).report.to_markdown end def test_reported_warnings skip 'Temporarily disable ...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/find_return_value.rb
Ruby
mit
47
master
3,348
require_relative '../test' require 'railroader/processors/lib/find_return_value' class FindReturnValueTests < Minitest::Test def assert_returns expected, original, env = nil expected = RubyParser.new.parse(expected) if expected.is_a? String original = RubyParser.new.parse(original) if original.is_a? String ...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/json_output.rb
Ruby
mit
47
master
1,879
require_relative '../test' require 'json' class JSONOutputTests < Minitest::Test def setup @@json ||= JSON.parse(Railroader.run("#{TEST_PATH}/apps/rails4").report.to_json) end def test_for_render_path @@json["warnings"].each do |warning| is_right_thing = warning.keys.include?("render_path") && (wa...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/call_index.rb
Ruby
mit
47
master
3,733
require_relative '../test' require 'railroader/processors/lib/find_all_calls' class CallIndexTests < Minitest::Test def setup @calls = [ {:method => :hello, :target => :world, :call => {}, :nested => false }, {:method => :goodbye, :target => :world, :call => {}, :nested => false }, {:method =>...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/warning.rb
Ruby
mit
47
master
702
require_relative '../test' require 'railroader/warning' class WarningTests < Minitest::Test def test_confidence_symbols [:high, :med, :medium, :low, :weak].each do |c| w = Railroader::Warning.new(confidence: c) assert_equal Railroader::Warning::CONFIDENCE[c], w.confidence end end def test_c...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/mass_assign_disable.rb
Ruby
mit
47
master
3,067
require_relative '../test' class MassAssignDisableTest < Minitest::Test include RailroaderTester::RescanTestHelper def mass_assign_disable content init = "config/initializers/mass_assign.rb" before_rescan_of init, "rails2" do write_file init, content end assert_changes assert_fixed 4 ...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/brakeman.rb
Ruby
mit
47
master
11,827
require 'tempfile' require_relative '../test' class RailroaderTests < Minitest::Test def test_exception_on_no_application assert_raises Railroader::NoApplication do Railroader.run "/tmp#{rand}" #better not exist end end def test_exception_no_on_no_application_if_forced assert_nothing_raised Ra...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/alias_processor.rb
Ruby
mit
47
master
18,119
require_relative '../test' class AliasProcessorTests < Minitest::Test def assert_alias expected, original, full = false original_sexp = RubyParser.new.parse original expected_sexp = RubyParser.new.parse expected processed_sexp = Railroader::AliasProcessor.new.process_safely original_sexp if full ...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/sexp.rb
Ruby
mit
47
master
9,332
require_relative '../test' require 'railroader/processors/base_processor' class SexpTests < Minitest::Test def setup @ruby_parser = ::RubyParser end def parse string Railroader::BaseProcessor.new(nil).process @ruby_parser.new.parse string end def test_method_call_with_no_args exp = parse "x.y" ...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/rails5.rb
Ruby
mit
47
master
31,284
require_relative '../test' class Rails5Tests < Minitest::Test include RailroaderTester::FindWarning include RailroaderTester::CheckExpected def report @@report ||= RailroaderTester.run_scan "rails5", "Rails 5", run_all_checks: true end def expected @@expected ||= { :controller => 0, :mo...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/commandline.rb
Ruby
mit
47
master
2,556
require_relative '../test' require 'railroader/commandline' class CLExit < StandardError attr_reader :exit_code def initialize exit_code, message super message @exit_code = exit_code end end class TestCommandline < Railroader::Commandline def self.quit exit_code = 0, message = nil raise CLExit.n...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/cves.rb
Ruby
mit
47
master
7,027
require_relative '../test' require 'railroader/rescanner' class CVETests < Minitest::Test include RailroaderTester::RescanTestHelper include RailroaderTester::FindWarning def report @rescanner.tracker.report.to_hash end def assert_version version, gem = :rails if gem == :rails assert_equal ve...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/output_processor.rb
Ruby
mit
47
master
5,647
require_relative '../test' class OutputProcessorTests < Minitest::Test def assert_output expected, original output = Railroader::OutputProcessor.new.format original assert_equal expected, output end def test_output_nil assert_output "[Format Error]", nil end def test_output_empty_sexp asse...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/rails_with_xss_plugin.rb
Ruby
mit
47
master
13,050
require_relative '../test' class RailsWithXssPluginTests < Minitest::Test include RailroaderTester::FindWarning include RailroaderTester::CheckExpected def expected @expected ||= { :controller => 1, :model => 3, :template => 4, :generic => 29 } end def report @@report ||= Ra...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/render_path.rb
Ruby
mit
47
master
1,732
require_relative '../test' class RenderPathTests < Minitest::Test def setup @r = Railroader::RenderPath.new end def test_include_controller @r.add_controller_render :TestController, :test, 1, 'app/controllers/test_controller.rb' assert @r.include_controller? :TestController end def test_render...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/rails4.rb
Ruby
mit
47
master
65,173
require_relative '../test' class Rails4Tests < Minitest::Test include RailroaderTester::FindWarning include RailroaderTester::CheckExpected def report external_checks_path = File.expand_path(File.join(File.dirname(__FILE__), "..", "/apps/rails4/external_checks")) # There are additional options in config...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/codeclimate_engine_configuration.rb
Ruby
mit
47
master
2,983
require_relative '../test' require 'railroader/codeclimate/engine_configuration' class EngineConfigurationTests < Minitest::Test def test_for_expected_keys config = { "include_paths" => ["/foo"] } expected = [:app_path, :only_files, :output_files, :output_format, :pager, :quiet] actual = Railr...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/rails4_with_engines.rb
Ruby
mit
47
master
14,802
require_relative '../test' class Rails4WithEnginesTests < Minitest::Test include RailroaderTester::FindWarning include RailroaderTester::CheckExpected def expected @expected ||= { :controller => 2, :model => 5, :template => 12, :generic => 13 } end def report @@report ||= Rai...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/rails3.rb
Ruby
mit
47
master
47,240
require_relative '../test' class Rails3Tests < Minitest::Test include RailroaderTester::FindWarning include RailroaderTester::CheckExpected def report @@report ||= RailroaderTester.run_scan "rails3", "Rails 3", :rails3 => true, :config_file => File.join(TEST_PATH, "apps", "rails3", "config", "railroad...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/only_files_option.rb
Ruby
mit
47
master
5,517
require_relative '../test' class OnlyFilesOptionTests < Minitest::Test include RailroaderTester::FindWarning include RailroaderTester::CheckExpected parallelize_me! def expected @expected ||= { :controller => 8, :model => 0, :template => 1, :generic => 14 } if RUBY_PLATFORM ==...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/rails2.rb
Ruby
mit
47
master
51,937
# NOTE: Please do not add any further tests to the Rails 2 application unless # the issue being tested specifically applies to Rails 2 and not the other # versions. # If possible, please use the rails5 app. require_relative '../test' class Rails2Tests < Minitest::Test include RailroaderTester::FindWarning include...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/tests/rails_lts.rb
Ruby
mit
47
master
1,716
require_relative '../test' require 'railroader/rescanner' class RailsLTSTests < Minitest::Test include RailroaderTester::RescanTestHelper def test_gemfile_lock_rails_lts gemfile = "Gemfile.lock" before_rescan_of gemfile, "rails_with_xss_plugin" do append gemfile, "railslts-version (2.3.18.6)" e...
github
paulsamuels/sidir-alfred-workflow
https://github.com/paulsamuels/sidir-alfred-workflow
lib/sidir.rb
Ruby
mit
47
master
363
module Sidir def self.find query='', root_dir=File.expand_path("~/Library/Application Support/iPhone Simulator") items_node = REXML::Element.new("items") ResultsFactory.results(root_dir, query).each { |item| items_node << item.to_xml } REXML::Document.new << items_node end end require 'sidir/re...
github
paulsamuels/sidir-alfred-workflow
https://github.com/paulsamuels/sidir-alfred-workflow
lib/spec/unit/result_item_spec.rb
Ruby
mit
47
master
2,673
require 'support/spec_helper' require 'sidir/result_items/result_item' module Sidir describe ResultItem do subject(:result_item) { ResultItem.new } it { should respond_to :path, :path= } it { should respond_to :icon, :icon= } it { should respond_to :title, :title= } it { should respond_to :s...
github
paulsamuels/sidir-alfred-workflow
https://github.com/paulsamuels/sidir-alfred-workflow
lib/spec/support/spec_helper.rb
Ruby
mit
47
master
286
$:.<< File.expand_path '../../../', __FILE__ require 'lorax' MOCK_DIR = File.expand_path('../MockSimDir', __FILE__) def verify_xml expected, actual Lorax::Signature.new(Nokogiri::XML(expected).root).signature.should eq(Lorax::Signature.new(Nokogiri::XML(actual).root).signature) end
github
paulsamuels/sidir-alfred-workflow
https://github.com/paulsamuels/sidir-alfred-workflow
lib/spec/acceptance/query_spec.rb
Ruby
mit
47
master
4,295
require 'support/spec_helper' require 'sidir' module Sidir describe "Sidir::find" do context "an empty search" do it "returns all the simulators as items" do expected = "<items><item arg='#{MOCK_DIR}/5.0/' autocomplete='5.0/' uid='sidir/5.0' valid='no'><title>5.0</title><subtitle>Show 2 apps instal...
github
paulsamuels/sidir-alfred-workflow
https://github.com/paulsamuels/sidir-alfred-workflow
lib/sidir/result_items.rb
Ruby
mit
47
master
274
require 'sidir/result_items/result_item' require 'sidir/result_items/path_result' require 'sidir/result_items/simulator_application_result' require 'sidir/result_items/null_result' require 'sidir/result_items/simulator_result' require 'sidir/result_items/application_result'
github
paulsamuels/sidir-alfred-workflow
https://github.com/paulsamuels/sidir-alfred-workflow
lib/sidir/results_factory.rb
Ruby
mit
47
master
1,342
module Sidir class ResultsFactory def self.results(root_dir, query) new(root_dir, query).results end def initialize root_dir, query @root_dir, @query = root_dir, query end def results items = [] Dir[search_meta_data.glob].each do |path| result_item = searc...
github
paulsamuels/sidir-alfred-workflow
https://github.com/paulsamuels/sidir-alfred-workflow
lib/sidir/result_items/simulator_application_result.rb
Ruby
mit
47
master
518
module Sidir class SimulatorApplicationResult < PathResult def initialize path, query super self.uid = "sidir/#{basename}" self.icon = 'app_folder.png' self.arg = path end def title File.basename(Dir["#{path}/*.app"].first, '.app') end def subtitle ...
github
paulsamuels/sidir-alfred-workflow
https://github.com/paulsamuels/sidir-alfred-workflow
lib/sidir/result_items/simulator_result.rb
Ruby
mit
47
master
720
module Sidir class SimulatorResult < PathResult def initialize path, query super self.uid = "sidir/#{title}" self.valid = 'no' self.icon = 'simulator_folder.png' self.autocomplete = "#{title}/" self.arg = arg_path end def title ...
github
paulsamuels/sidir-alfred-workflow
https://github.com/paulsamuels/sidir-alfred-workflow
lib/sidir/result_items/application_result.rb
Ruby
mit
47
master
650
module Sidir class ApplicationResult < SimulatorApplicationResult def initialize path, query super self.uid = "sidir/#{basename}" self.icon = 'app_folder.png' self.arg = path end def title prefix = File.basename(File.expand_path('../../', path)) "#{prefix}/#{app_...
github
paulsamuels/sidir-alfred-workflow
https://github.com/paulsamuels/sidir-alfred-workflow
lib/sidir/result_items/null_result.rb
Ruby
mit
47
master
295
module Sidir class NullResult < PathResult def initialize path, query super self.title = 'No apps found' self.subtitle = 'Open simulator directory' self.icon = 'logo.png' self.uid = 'sidir/show_all' self.arg = path end end end
github
paulsamuels/sidir-alfred-workflow
https://github.com/paulsamuels/sidir-alfred-workflow
lib/sidir/result_items/result_item.rb
Ruby
mit
47
master
696
require 'rexml/document' module Sidir class ResultItem attr_accessor :path, :icon, :title, :subtitle, :uid, :valid, :autocomplete, :arg def initialize yield self if block_given? end def to_xml new_item = REXML::Element.new('item') new_item.add_attributes(attributes) ...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
Gemfile
Ruby
mit
47
main
502
source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } # Specify your gem's dependencies in webauthn-rails.gemspec. gemspec gem "rails", "~> 8.0" gem "puma" gem "sqlite3", "~> 2.7" gem "propshaft", "~> 1.2" gem "importmap-rails" gem "hotwire-rails" gem "stimulus-rails" ge...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
webauthn-rails.gemspec
Ruby
mit
47
main
995
require_relative "lib/webauthn/rails/version" Gem::Specification.new do |spec| spec.name = "webauthn-rails" spec.version = Webauthn::Rails::VERSION spec.authors = [ "Cedarcode" ] spec.email = [ "webauthn@cedarcode.com" ] spec.homepage = "https://github.com/cedarcode/webauthn-rails" ...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
Rakefile
Ruby
mit
47
main
423
require "bundler/setup" require 'rake/testtask' require "bundler/gem_tasks" Rake::TestTask.new(:test) do |t| t.libs << 'lib' t.libs << 'test' t.test_files = FileList['test/**/*_test.rb'].exclude('test/tmp/**/*_test.rb').exclude('test/dummy/**/*_test.rb') end Rake::TestTask.new(:test_dummy) do |t| t.libs << '...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
test/generators/webauthn_authentication_generator_test.rb
Ruby
mit
47
main
7,663
require "test_helper" require "rails/generators/test_case" require "generators/webauthn_authentication/webauthn_authentication_generator" require "rails/generators/rails/authentication/authentication_generator" class WebauthnAuthenticationGeneratorTest < Rails::Generators::TestCase tests WebauthnAuthenticationGenera...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
test/dummy/test/application_system_test_case.rb
Ruby
mit
47
main
377
require "test_helper" class ApplicationSystemTestCase < ActionDispatch::SystemTestCase driven_by :selenium, using: (ENV["TEST_BROWSER"] || :headless_chrome).to_sym, screen_size: [ 1400, 1400 ] setup do Capybara.app_host = "http://localhost:3030" Capybara.server_host = "localhost" Capybara.server_port ...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
test/dummy/test/test_helper.rb
Ruby
mit
47
main
392
ENV["RAILS_ENV"] ||= "test" require_relative "../config/environment" require "rails/test_help" require_relative "test_helpers/session_test_helper" module ActiveSupport class TestCase include SessionTestHelper # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. fixtures :all ...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
test/dummy/test/controllers/second_factor_authentications_controller_test.rb
Ruby
mit
47
main
4,735
require "test_helper" require "webauthn/fake_client" class SecondFactorAuthenticationsControllerTest < ActionDispatch::IntegrationTest setup do @user = users(:one) @client = WebAuthn::FakeClient.new(WebAuthn.configuration.allowed_origins.first) creation_options = WebAuthn::Credential.options_for_create(...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
test/dummy/test/controllers/second_factor_webauthn_credentials_controller_test.rb
Ruby
mit
47
main
2,941
require "test_helper" require "webauthn/fake_client" class SecondFactorWebauthnCredentialsControllerTest < ActionDispatch::IntegrationTest setup do @user = users(:one) @client = WebAuthn::FakeClient.new(WebAuthn.configuration.allowed_origins.first) end test "create_options" do sign_in_as @user p...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
test/dummy/test/controllers/passkeys_controller_test.rb
Ruby
mit
47
main
2,639
require "test_helper" require "webauthn/fake_client" class PasskeysControllerTest < ActionDispatch::IntegrationTest setup do @user = users(:one) @client = WebAuthn::FakeClient.new(WebAuthn.configuration.allowed_origins.first) end test "create_options" do sign_in_as @user post create_options_pass...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
test/dummy/test/controllers/webauthn_sessions_controller_test.rb
Ruby
mit
47
main
3,750
require "test_helper" require "webauthn/fake_client" class WebauthnSessionsControllerTest < ActionDispatch::IntegrationTest setup do @user = users(:one) @client = WebAuthn::FakeClient.new(WebAuthn.configuration.allowed_origins.first) creation_options = WebAuthn::Credential.options_for_create( user...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
test/dummy/test/test_helpers/session_test_helper.rb
Ruby
mit
47
main
292
module SessionTestHelper def sign_in_as(user) Current.session = user.sessions.create! ActionDispatch::TestRequest.create.cookie_jar.tap do |cookie_jar| cookie_jar.signed[:session_id] = Current.session.id cookies[:session_id] = cookie_jar[:session_id] end end end
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
test/dummy/test/test_helpers/virtual_authenticator_test_helper.rb
Ruby
mit
47
main
1,711
module VirtualAuthenticatorTestHelper def add_virtual_authenticator options = ::Selenium::WebDriver::VirtualAuthenticatorOptions.new options.user_verification = true options.user_verified = true options.resident_key = true page.driver.browser.add_virtual_authenticator(options) end def add_pas...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
test/dummy/test/mailers/previews/passwords_mailer_preview.rb
Ruby
mit
47
main
274
# Preview all emails at http://localhost:3000/rails/mailers/passwords_mailer class PasswordsMailerPreview < ActionMailer::Preview # Preview this email at http://localhost:3000/rails/mailers/passwords_mailer/reset def reset PasswordsMailer.reset(User.take) end end
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
test/dummy/test/system/manage_webauthn_credentials_test.rb
Ruby
mit
47
main
2,138
require "application_system_test_case" require_relative "../test_helpers/virtual_authenticator_test_helper" class ManageWebauthnCredentialsTest < ApplicationSystemTestCase include VirtualAuthenticatorTestHelper def setup @user = User.create!(email_address: "alice@example.com", password: "S3cr3tP@ssw0rd!") ...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
test/dummy/app/channels/application_cable/connection.rb
Ruby
mit
47
main
374
module ApplicationCable class Connection < ActionCable::Connection::Base identified_by :current_user def connect set_current_user || reject_unauthorized_connection end private def set_current_user if session = Session.find_by(id: cookies.signed[:session_id]) self.curren...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
test/dummy/app/models/user.rb
Ruby
mit
47
main
530
class User < ApplicationRecord has_secure_password has_many :sessions, dependent: :destroy normalizes :email_address, with: ->(e) { e.strip.downcase } has_many :webauthn_credentials, dependent: :destroy with_options class_name: "WebauthnCredential" do has_many :second_factor_webauthn_credentials, -> { s...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
test/dummy/app/models/webauthn_credential.rb
Ruby
mit
47
main
428
class WebauthnCredential < ApplicationRecord belongs_to :user validates :external_id, :public_key, :nickname, :sign_count, presence: true validates :external_id, uniqueness: true validates :sign_count, numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 2**32 - 1 } en...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
test/dummy/app/controllers/passkeys_controller.rb
Ruby
mit
47
main
1,780
class PasskeysController < ApplicationController def create_options create_options = WebAuthn::Credential.options_for_create( user: { id: Current.user.webauthn_id, name: Current.user.email_address }, exclude: Current.user.webauthn_credentials.pluck(:external_id), authentica...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
test/dummy/app/controllers/webauthn_sessions_controller.rb
Ruby
mit
47
main
1,488
class WebauthnSessionsController < ApplicationController allow_unauthenticated_access only: %i[get_options create] def get_options get_options = WebAuthn::Credential.options_for_get(user_verification: "required") session[:current_authentication] = { challenge: get_options.challenge } render json: get_...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
test/dummy/app/controllers/sessions_controller.rb
Ruby
mit
47
main
781
class SessionsController < ApplicationController allow_unauthenticated_access only: %i[ new create ] rate_limit to: 10, within: 3.minutes, only: :create, with: -> { redirect_to new_session_url, alert: "Try again later." } def new end def create if user = User.authenticate_by(params.permit(:email_address...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
test/dummy/app/controllers/second_factor_authentications_controller.rb
Ruby
mit
47
main
1,886
class SecondFactorAuthenticationsController < ApplicationController allow_unauthenticated_access only: %i[new get_options create] before_action :require_no_authentication before_action :ensure_login_initiated def get_options get_options = WebAuthn::Credential.options_for_get( allow: user.webauthn_cre...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
test/dummy/app/controllers/passwords_controller.rb
Ruby
mit
47
main
971
class PasswordsController < ApplicationController allow_unauthenticated_access before_action :set_user_by_token, only: %i[ edit update ] def new end def create if user = User.find_by(email_address: params[:email_address]) PasswordsMailer.reset(user).deliver_later end redirect_to new_sessi...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
test/dummy/app/controllers/second_factor_webauthn_credentials_controller.rb
Ruby
mit
47
main
1,890
class SecondFactorWebauthnCredentialsController < ApplicationController def create_options create_options = WebAuthn::Credential.options_for_create( user: { id: Current.user.webauthn_id, name: Current.user.email_address }, exclude: Current.user.webauthn_credentials.pluck(:externa...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
test/dummy/app/controllers/concerns/authentication.rb
Ruby
mit
47
main
1,394
module Authentication extend ActiveSupport::Concern included do before_action :require_authentication helper_method :authenticated? end class_methods do def allow_unauthenticated_access(**options) skip_before_action :require_authentication, **options end end private def authenti...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
test/dummy/config/importmap.rb
Ruby
mit
47
main
431
# Pin npm packages by running ./bin/importmap pin "application" pin "@hotwired/turbo-rails", to: "turbo.min.js" pin "@hotwired/stimulus", to: "stimulus.min.js" pin "@hotwired/stimulus-loading", to: "stimulus-loading.js" pin_all_from "app/javascript/controllers", under: "controllers" pin "@github/webauthn-json/browser-...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
test/dummy/config/routes.rb
Ruby
mit
47
main
582
Rails.application.routes.draw do resource :webauthn_session, only: [ :create, :destroy ] do post :get_options, on: :collection end resources :passkeys, only: [ :new, :create, :destroy ] do post :create_options, on: :collection end resources :second_factor_webauthn_credentials, only: [ :new, :create,...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
test/dummy/config/initializers/webauthn.rb
Ruby
mit
47
main
318
WebAuthn.configure do |config| # This value needs to match `window.location.origin` evaluated by # the User Agent during registration and authentication ceremonies. config.allowed_origins = [ "http://localhost:3030" ] # Relying Party name for display purposes config.rp_name = "WebAuthn Rails Demo App" end
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
test/dummy/db/schema.rb
Ruby
mit
47
main
2,011
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # This file is the source Rails uses to define your schema when running `bin/rai...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
test/dummy/db/migrate/20250904175227_create_users.rb
Ruby
mit
47
main
270
class CreateUsers < ActiveRecord::Migration[8.0] def change create_table :users do |t| t.string :email_address, null: false t.string :password_digest, null: false t.timestamps end add_index :users, :email_address, unique: true end end
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
test/dummy/db/migrate/20250922185347_create_webauthn_credentials.rb
Ruby
mit
47
main
461
class CreateWebauthnCredentials < ActiveRecord::Migration[8.0] def change create_table :webauthn_credentials do |t| t.references :user, null: false, foreign_key: true t.string :external_id t.string :public_key t.string :nickname t.integer :sign_count, limit: 8 t.integer :authen...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
lib/generators/test_unit/webauthn_authentication/webauthn_authentication_generator.rb
Ruby
mit
47
main
828
require "rails/generators/test_unit" module TestUnit module Generators class WebauthnAuthenticationGenerator < Rails::Generators::Base hide! source_root File.expand_path("../templates", __FILE__) def create_controller_test_files template "test/controllers/passkeys_controller_test.rb" ...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
lib/generators/test_unit/webauthn_authentication/templates/test/controllers/second_factor_authentications_controller_test.rb
Ruby
mit
47
main
4,325
require "test_helper" require "webauthn/fake_client" class SecondFactorAuthenticationsControllerTest < ActionDispatch::IntegrationTest setup do @user = users(:one) @client = WebAuthn::FakeClient.new(WebAuthn.configuration.allowed_origins.first) creation_options = WebAuthn::Credential.options_for_create(...
github
cedarcode/webauthn-rails
https://github.com/cedarcode/webauthn-rails
lib/generators/erb/webauthn_authentication/webauthn_authentication_generator.rb
Ruby
mit
47
main
1,294
require "rails/generators/erb" module Erb module Generators class WebauthnAuthenticationGenerator < Rails::Generators::Base hide! source_root File.expand_path("../templates", __FILE__) def create_files template "app/views/passkeys/new.html.erb.tt" template "app/views/second_fac...