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 | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/strategy/base.rb | Ruby | mit | 216 | main | 1,443 | module InfinityTest
module Strategy
class Base
def initialize(continuous_test_server)
@continuous_test_server = continuous_test_server
end
# ==== Returns
# CommandBuilderClass: A class that builds that command using method_missing.
#
def command_builder
Core::C... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/strategy/ruby_default.rb | Ruby | mit | 216 | main | 529 | module InfinityTest
module Strategy
class RubyDefault < Base
attr_reader :continuous_test_server
delegate :binary, :test_files, to: :continuous_test_server
def run!
command = "#{binary} #{test_files}"
with_bundler(command)
end
# ==== Returns
# TrueClass: If t... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/strategy/elixir_default.rb | Ruby | mit | 216 | main | 515 | module InfinityTest
module Strategy
class ElixirDefault < Base
attr_reader :continuous_test_server
delegate :binary, :test_files, to: :continuous_test_server
def run!
command = "#{binary} test #{test_files}"
command = "#{command} #{Core::Base.specific_options}" if Core::Base.spe... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/strategy/python_default.rb | Ruby | mit | 216 | main | 588 | module InfinityTest
module Strategy
class PythonDefault < Base
attr_reader :continuous_test_server
delegate :binary, :test_files, to: :continuous_test_server
def run!
command = "#{binary} #{test_files}"
command = "#{command} #{Core::Base.specific_options}" if Core::Base.specific... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/strategy/rust_default.rb | Ruby | mit | 216 | main | 571 | module InfinityTest
module Strategy
class RustDefault < Base
attr_reader :continuous_test_server
delegate :binary, :test_files, to: :continuous_test_server
def run!
command = "#{binary} test"
command = "#{command} #{test_files}" if test_files.present?
command = "#{comman... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/strategy/rvm.rb | Ruby | mit | 216 | main | 1,701 | module InfinityTest
module Strategy
class Rvm < Base
attr_reader :continuous_test_server
delegate :binary, :test_files, to: :continuous_test_server
# Build and run commands for each ruby version specified.
# Uses RVM's `rvm <version> do` syntax to run tests in different Ruby environments.... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/strategy/shared_example.rb | Ruby | mit | 216 | main | 914 | module InfinityTest
module Strategy
module SharedExample
# Shared Examples to use in the RSpec specs when you want create your own strategy
#
# ==== Examples
#
# RSpec.configure do |config|
# config.include InfinityTest::Strategy::SharedExample
# end
#
... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/framework/base.rb | Ruby | mit | 216 | main | 3,212 | module InfinityTest
module Framework
class Base
attr_reader :continuous_test_server, :hike
delegate :observer, :test_framework, :extension, to: :continuous_test_server
delegate :watch, :watch_dir, to: :observer
def initialize(continuous_test_server)
@continuous_test_server = conti... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/framework/fast_api.rb | Ruby | mit | 216 | main | 3,138 | module InfinityTest
module Framework
class FastApi < Base
delegate :test_dir, :test_helper_file, to: :test_framework
# Override to use .py extension for Python test files.
#
def heuristics!
hike.append_extension('.py')
hike.append_path(test_framework.test_dir)
heur... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/framework/rails.rb | Ruby | mit | 216 | main | 778 | module InfinityTest
module Framework
class Rails < Base
delegate :test_dir, :test_helper_file, to: :test_framework
# Add Heuristics to the observer run on pattern changes!
#
# ==== Heuristics
# * Watch all app/* directories and run corresponding tests/specs
# * Watch lib dir... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/framework/rocket.rb | Ruby | mit | 216 | main | 2,307 | module InfinityTest
module Framework
class Rocket < Base
delegate :test_dir, :test_helper_file, to: :test_framework
# Override to use .rs extension for Rust files.
#
def heuristics!
hike.append_extension('.rs')
hike.append_path(test_framework.test_dir) if File.directory?(t... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/framework/rubygems.rb | Ruby | mit | 216 | main | 879 | module InfinityTest
module Framework
class Rubygems < Base
delegate :test_dir, :test_helper_file, to: :test_framework
# Add Heuristics to the observer run on pattern changes!
#
# ==== Heuristics
# * Add Gemfile and Run bundle install and run all specs.
# * Observe lib dir an... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/framework/padrino.rb | Ruby | mit | 216 | main | 945 | module InfinityTest
module Framework
class Padrino < Base
delegate :test_dir, :test_helper_file, to: :test_framework
# Add Heuristics to the observer run on pattern changes!
#
# ==== Heuristics
# * Watch all app/* directories and run corresponding tests/specs
# * Watch lib d... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/framework/elixir_mix.rb | Ruby | mit | 216 | main | 1,460 | module InfinityTest
module Framework
class ElixirMix < Base
delegate :test_dir, :test_helper_file, to: :test_framework
# Override to use .exs extension for Elixir test files.
#
def heuristics!
hike.append_extension('.exs')
hike.append_path(test_framework.test_dir)
... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/framework/django.rb | Ruby | mit | 216 | main | 3,335 | module InfinityTest
module Framework
class Django < Base
delegate :test_dir, :test_helper_file, to: :test_framework
# Override to use .py extension for Python test files.
#
def heuristics!
hike.append_extension('.py')
hike.append_path(test_framework.test_dir)
heuri... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/framework/rust_cargo.rb | Ruby | mit | 216 | main | 2,217 | module InfinityTest
module Framework
class RustCargo < Base
delegate :test_dir, :test_helper_file, to: :test_framework
# Override to use .rs extension for Rust files.
#
def heuristics!
hike.append_extension('.rs')
hike.append_path(test_framework.test_dir) if File.directory... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/framework/shared_example.rb | Ruby | mit | 216 | main | 1,246 | module InfinityTest
module Framework
module SharedExample
# Shared Examples to use in the RSpec specs when you want create your own observer.
#
# ==== Examples
#
# RSpec.configure do |config|
# config.include InfinityTest::Observer::SharedExample
# end
#
... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/framework/phoenix.rb | Ruby | mit | 216 | main | 2,517 | module InfinityTest
module Framework
class Phoenix < Base
delegate :test_dir, :test_helper_file, to: :test_framework
# Override to use .exs extension for Elixir test files.
#
def heuristics!
hike.append_extension('.exs')
hike.append_path(test_framework.test_dir)
he... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/framework/python_package.rb | Ruby | mit | 216 | main | 2,884 | module InfinityTest
module Framework
class PythonPackage < Base
delegate :test_dir, :test_helper_file, to: :test_framework
# Override to use .py extension for Python test files.
#
def heuristics!
hike.append_extension('.py')
hike.append_path(test_framework.test_dir)
... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/observer/listen.rb | Ruby | mit | 216 | main | 2,103 | require 'listen'
module InfinityTest
module Observer
class Listen < Base
attr_reader :observer, :directories, :patterns
def initialize(continuous_test_server)
super
@directories = []
@patterns = {}
end
# Watch a file or pattern for changes.
#
# ==== E... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/observer/shared_example.rb | Ruby | mit | 216 | main | 916 | module InfinityTest
module Observer
module SharedExample
# Shared Examples to use in the RSpec specs when you want create your own observer.
#
# ==== Examples
#
# RSpec.configure do |config|
# config.include InfinityTest::Observer::SharedExample
# end
#
... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/observer/filewatcher.rb | Ruby | mit | 216 | main | 2,040 | require 'filewatcher'
module InfinityTest
module Observer
class Filewatcher < Base
attr_reader :observer, :watch_paths, :patterns
def initialize(continuous_test_server)
super
@watch_paths = []
@patterns = {}
end
# Watch a file or pattern for changes.
#
... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/observer/base.rb | Ruby | mit | 216 | main | 948 | module InfinityTest
module Observer
class Base
attr_accessor :continuous_test_server
def initialize(continuous_test_server)
@continuous_test_server = continuous_test_server
end
def watch(pattern_or_file, &block)
raise NotImplementedError, "not implemented in #{self}"
... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/core/runner.rb | Ruby | mit | 216 | main | 404 | module InfinityTest
module Core
class Runner
attr_accessor :options
def initialize(*arguments)
@options = Options.new(arguments).parse!
end
def start
Core::LoadConfiguration.new.load!
Core::Base.merge!(options)
Core::AutoDiscover.new(Core::Base).discover_l... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/core/auto_discover.rb | Ruby | mit | 216 | main | 2,235 | module InfinityTest
module Core
class AutoDiscover
attr_reader :base
# Priority order for auto discovery (higher priority first)
# More specific libraries should be checked before generic ones
PRIORITY = {
strategy: [:rvm, :rbenv, :elixir_default, :python_default, :rust_default, :... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/core/base.rb | Ruby | mit | 216 | main | 11,345 | module InfinityTest
module Core
class Base
# Specify the Ruby Version Manager to run
cattr_accessor :strategy
# ==== Options
# * :rvm
# * :rbenv
# * :ruby_normal (Use when don't pass any rubies to run)
# * :auto_discover(defaults)
self.strategy = :auto_discover
... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/core/notifier.rb | Ruby | mit | 216 | main | 1,347 | module InfinityTest
module Core
class Notifier
include ::Notifiers
attr_reader :test_framework, :library
IMAGES = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'images'))
delegate :test_message, to: :test_framework
def initialize(options)
@test_fram... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/core/changed_file.rb | Ruby | mit | 216 | main | 270 | module InfinityTest
module Core
class ChangedFile
attr_accessor :match_data, :name, :path
def initialize(match_data)
@match_data = match_data
@name = match_data.to_s
@path = match_data[1]
end
end
end
end |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/core/continuous_test_server.rb | Ruby | mit | 216 | main | 3,969 | module InfinityTest
module Core
class ContinuousTestServer
attr_reader :base
delegate :binary, :test_files, to: :test_framework
delegate :infinity_and_beyond, :notifications, :extension, :just_watch, :focus, to: :base
def initialize(base)
@base = base
end
def start
... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/core/load_configuration.rb | Ruby | mit | 216 | main | 1,246 | module InfinityTest
module Core
class LoadConfiguration
attr_accessor :global_file, :project_file
def initialize
@global_file = File.expand_path('~/INFINITY_TEST')
@project_file = './INFINITY_TEST'
@old_configuration = InfinityTest::OldDSL::Configuration
end
# Lo... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/core/command_runner.rb | Ruby | mit | 216 | main | 712 | require 'pty'
module InfinityTest
module Core
class CommandRunner < String
attr_accessor :command
def initialize(command)
@command = command
super(run!)
end
def run!
output = []
old_sync = $stdout.sync
$stdout.sync = true
begin
... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/core/command_builder.rb | Ruby | mit | 216 | main | 1,028 | module InfinityTest
module Core
class CommandBuilder < String
# Just Syntax Sugar to add the keyword in the command
#
def add(command)
self << " #{command.to_s}"
self
end
# Put a double-dash in the command option.
#
def opt(command_option)
self <<... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/core/configuration_merge.rb | Ruby | mit | 216 | main | 1,499 | module InfinityTest
module Core
class ConfigurationMerge
attr_accessor :base, :options
delegate :strategy, :rubies, :test_framework, :framework, :to => :options
delegate :specific_options, :infinity_and_beyond, :verbose, :bundler, :to => :options
delegate :notifications, :mode, :just_watc... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/core/callback.rb | Ruby | mit | 216 | main | 1,245 | module InfinityTest
module Core
class Callback
attr_reader :scope, :block, :type
VALID_SCOPES = [:all, :each_ruby].freeze
# Create a new callback
#
# @param type [Symbol] :before or :after
# @param scope [Symbol] :all or :each_ruby (defaults to :all)
# @param block [Pro... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/core/options.rb | Ruby | mit | 216 | main | 4,181 | module InfinityTest
module Core
class Options
attr_accessor :arguments, :options_parser, :strategy, :bundler, :verbose
attr_accessor :rubies, :specific_options, :test_framework, :framework, :infinity_and_beyond
attr_accessor :notifications, :mode, :just_watch, :focus
def initialize(*argum... |
github | tomas-stefano/infinity_test | https://github.com/tomas-stefano/infinity_test | lib/infinity_test/old_dsl/configuration.rb | Ruby | mit | 216 | main | 852 | module InfinityTest
module OldDSL
class Configuration
# Pass the responsability to InfinityTest::Base class.
#
# <b>Don't need #super or #respond_to here.</b>
# <b>This class will be removed in infinity_test 2.0.1</b>
#
def method_missing(method_name, *arguments, &block)
... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | Gemfile | Ruby | mit | 216 | master | 659 | source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '~> 3.3.0'
gem 'rails', '~> 7.1.0'
gem 'pg', '~> 1.0'
gem 'puma', '~> 6.0'
gem 'redis', '~> 5.0'
gem 'grpc', '~> 1.37'
gem 'anycable-rails', '~> 1.5'
gem 'daemons', '~> 1.3', require: false
gem 'bootsnap', '>= 1.4.2', ... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | app/models/application_record.rb | Ruby | mit | 216 | master | 225 | # frozen_string_literal: true
class ApplicationRecord < ActiveRecord::Base
primary_abstract_class
PAGE_SIZE = 20
class << self
def page(num)
limit(PAGE_SIZE).offset((num - 1) * PAGE_SIZE)
end
end
end |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | app/models/workspace.rb | Ruby | mit | 216 | master | 401 | # frozen_string_literal: true
class Workspace < ApplicationRecord
has_many :lists, -> { order(id: :asc) }, inverse_of: :workspace, dependent: :destroy
validates :name, :public_id, presence: true, length: {maximum: 255}
before_validation :assign_uniq_id, unless: :public_id
def to_param() = public_id
priva... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | app/models/list.rb | Ruby | mit | 216 | master | 234 | # frozen_string_literal: true
class List < ApplicationRecord
has_many :items, -> { order(id: :asc) }, dependent: :delete_all, inverse_of: :list
belongs_to :workspace
validates :name, presence: true, length: {maximum: 255}
end |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | app/models/user.rb | Ruby | mit | 216 | master | 333 | # frozen_string_literal: true
# Virtual model to represent current user in the app
class User
include ActiveModel::Model
include ActiveModel::Attributes
include AnycableIdentified
attribute :name, :string
attribute :id, :string
class << self
def generate(name) = new(name:, id: Nanoid.generate(size: 5... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | app/models/concerns/anycable_identified.rb | Ruby | mit | 216 | master | 533 | # frozen_string_literal: true
module AnycableIdentified
extend ActiveSupport::Concern
include GlobalID::Identification
class_methods do
def find_by_gid(gid) = new(gid.params)
end
def to_global_id(options = {})
super(attributes.merge!(options).merge!(app: "anycable"))
end
alias_method :to_gid,... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | app/channels/list_channel.rb | Ruby | mit | 216 | master | 415 | # frozen_string_literal: true
class ListChannel < ApplicationCable::Channel
# Replace with state_attr_accessor if new actions are added
attr_accessor :workspace, :list
def subscribed
self.workspace = Workspace.find_by(public_id: params[:workspace])
return reject unless workspace
self.list = workspa... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | app/channels/workspace_channel.rb | Ruby | mit | 216 | master | 323 | # frozen_string_literal: true
class WorkspaceChannel < ApplicationCable::Channel
# Replace with state_attr_accessor if new actions are added
attr_accessor :workspace
def subscribed
self.workspace = Workspace.find_by(public_id: params[:id])
return reject unless workspace
stream_for workspace
end
e... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | app/channels/chat_channel.rb | Ruby | mit | 216 | master | 491 | # frozen_string_literal: true
class ChatChannel < ApplicationCable::Channel
state_attr_accessor :workspace
def subscribed
self.workspace = Workspace.find_by(public_id: params[:id])
return reject unless workspace
stream_for workspace
end
def speak(data)
message = data.fetch("message")
nam... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | app/channels/application_cable/connection.rb | Ruby | mit | 216 | master | 316 | # frozen_string_literal: true
module ApplicationCable
class Connection < ActionCable::Connection::Base
include Authenticated
delegate :session, to: :request
identified_by :user
def connect
reject_unauthorized_connection unless logged_in?
self.user = current_user
end
end
end |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | app/channels/application_cable/channel.rb | Ruby | mit | 216 | master | 204 | # frozen_string_literal: true
module ApplicationCable
class Channel < ActionCable::Channel::Base
def html(partial, **locals)
ApplicationController.render(partial:, locals:)
end
end
end |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | app/services/workspaces/create_demo.rb | Ruby | mit | 216 | master | 1,534 | # frozen_string_literal: true
module Workspaces
module CreateDemo
class << self
def call(name: "Demo Workspace", public_id: nil, workspace: nil)
ActiveRecord::Base.transaction do
# We can use the existing workspace to populate demo data
demo = workspace || Workspace.create!(name... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | app/controllers/application_controller.rb | Ruby | mit | 216 | master | 331 | # frozen_string_literal: true
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
include Authenticated
before_action :authenticate_user!, unless: :logged_in?
private
def authenticate_user!
session[:redirect_after_login] = request.url
redirect_to(login_path)... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | app/controllers/sessions_controller.rb | Ruby | mit | 216 | master | 845 | # frozen_string_literal: true
class SessionsController < ApplicationController
before_action :redirect_logged_in, only: [:new, :create], if: :logged_in?
skip_before_action :authenticate_user!, only: [:new, :create]
def new
end
def create
# Handle negative captcha by simply rerendering the form
retu... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | app/controllers/lists_controller.rb | Ruby | mit | 216 | master | 1,354 | # frozen_string_literal: true
class ListsController < ApplicationController
before_action :set_workspace
before_action :set_list, only: [:destroy]
after_action :broadcast_new_list, only: [:create]
after_action :broadcast_changes, only: [:destroy]
attr_reader :workspace, :list
def create
@list = List... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | app/controllers/workspaces_controller.rb | Ruby | mit | 216 | master | 844 | # frozen_string_literal: true
class WorkspacesController < ApplicationController
skip_before_action :authenticate_user!, only: [:index]
def new
workspace = Workspace.new
render locals: {workspace:}
end
def create
workspace = Workspace.new(workspace_params)
if workspace.save
# populate d... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | app/controllers/items_controller.rb | Ruby | mit | 216 | master | 2,007 | # frozen_string_literal: true
class ItemsController < ApplicationController
before_action :set_workspace, :set_list
before_action :set_item, only: [:destroy, :update]
after_action :broadcast_new_item, only: [:create]
after_action :broadcast_changes, only: [:update, :destroy]
attr_reader :workspace, :list, ... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | app/controllers/concerns/authenticated.rb | Ruby | mit | 216 | master | 1,061 | # frozen_string_literal: true
# Provide utils for a simple authentication
module Authenticated
extend ActiveSupport::Concern
included do
next unless respond_to?(:helper_method)
helper_method :current_user
helper_method :logged_in?
end
def current_user
return @current_user if instance_variabl... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | spec/rails_helper.rb | Ruby | mit | 216 | master | 2,400 | # frozen_string_literal: true
ENV["RAILS_ENV"] = "test"
require "spec_helper"
begin
require File.expand_path("../../config/environment", __FILE__)
rescue => e
# Fail fast if application couldn't be loaded
$stdout.puts "Failed to load the app: #{e.message}\n#{e.backtrace.take(5).join("\n")}"
exit(1)
end
# Pr... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | spec/spec_helper.rb | Ruby | mit | 216 | master | 1,071 | # frozen_string_literal: true
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.syntax = :expect
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.syntax = :expect
mocks.verify_partial_doubles ... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | spec/system_helper.rb | Ruby | mit | 216 | master | 211 | # frozen_string_literal: true
require "rails_helper"
# system/support/ files contain system tests configurations and helpers
Dir[File.join(__dir__, "system/support/**/*.rb")].sort.each { |file| require file } |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | spec/channels/connection_spec.rb | Ruby | mit | 216 | master | 563 | # frozen_string_literal: true
require "rails_helper"
describe ApplicationCable::Connection do
let(:user) { User.generate("david") }
it "successfully connects via cookies" do
cookies[:uid] = "#{user.name}/#{user.id}"
connect "/cable"
expect(connection.user.id).to eq user.id
end
it "successfully ... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | spec/channels/workspace_channel_spec.rb | Ruby | mit | 216 | master | 742 | # frozen_string_literal: true
require "rails_helper"
describe WorkspaceChannel do
fixtures :workspaces
let(:user) { User.generate("aaron") }
let(:workspace) { workspaces(:demo) }
before do
stub_connection user: user
end
describe "#subscribe" do
it "rejects subscription without workspace id" do
... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | spec/channels/chat_channel_spec.rb | Ruby | mit | 216 | master | 1,017 | # frozen_string_literal: true
require "rails_helper"
describe ChatChannel do
fixtures :workspaces
let(:user) { User.generate("aaron") }
let(:workspace) { workspaces(:demo) }
before do
stub_connection user: user
end
describe "#subscribe" do
it "rejects subscription without workspace id" do
... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | spec/channels/list_channel_spec.rb | Ruby | mit | 216 | master | 1,105 | # frozen_string_literal: true
require "rails_helper"
describe ListChannel do
fixtures :workspaces, :lists
let(:user) { User.generate("aaron") }
let(:workspace) { workspaces(:demo) }
let(:list) { lists(:demo_cables) }
before do
stub_connection user: user
end
describe "#subscribe" do
it "reject... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | spec/system/support/cuprite_setup.rb | Ruby | mit | 216 | master | 1,868 | # frozen_string_literal: true
# Cuprite is a modern Capybara driver which uses Chrome CDP API
# instead of Selenium & co.
# See https://github.com/rubycdp/cuprite
remote_chrome_url = ENV["CHROME_URL"]
# Chrome doesn't allow connecting to CDP by hostnames (other than localhost),
# but allows using IP addresses.
if re... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | spec/system/support/precompile_assets.rb | Ruby | mit | 216 | master | 945 | # frozen_string_literal: true
# Precompile assets before running tests to avoid timeouts.
# Do not precompile if webpack-dev-server is running (NOTE: MUST be launched with RAILS_ENV=test)
RSpec.configure do |config|
config.before(:suite) do
examples = RSpec.world.filtered_examples.values.flatten
has_no_syste... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | spec/system/support/capybara_setup.rb | Ruby | mit | 216 | master | 1,103 | # frozen_string_literal: true
# Capybara settings (not covered by Rails system tests)
# Make server listening on all hosts
Capybara.server_host = "0.0.0.0"
Capybara.server_port = 3001
# Use a hostname accessible from the outside world
Capybara.app_host = "http://#{ENV.fetch("APP_HOST", `hostname`.strip&.downcase || "... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | spec/system/support/better_rails_system_tests.rb | Ruby | mit | 216 | master | 1,287 | # frozen_string_literal: true
module BetterRailsSystemTests
# Use relative path in screenshot message to make it clickable in VS Code when running in Docker
def image_path
Pathname.new(absolute_image_path).relative_path_from(Rails.root).to_s
end
# Make failure screenshots compatible with multi-session set... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | spec/system/support/session_helpers.rb | Ruby | mit | 216 | master | 358 | # frozen_string_literal: true
module SessionHelpers
def within_session(...)
Capybara.using_session(...)
end
def mark_all_banners_as_read!
page.driver.set_cookie "show_banners", "N"
end
end
RSpec.configure do |config|
config.include SessionHelpers, type: :system
config.before(type: :system) do
... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | spec/system/support/anycable_setup.rb | Ruby | mit | 216 | master | 573 | # frozen_string_literal: true
require "action_cable/subscription_adapter/any_cable"
# Run AnyCable RPC server
RSpec.configure do |config|
cli = nil
config.before(:suite) do
examples = RSpec.world.filtered_examples.values.flatten
has_no_system_tests = examples.none? { |example| example.metadata[:type] == ... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | spec/system/workspaces/index_spec.rb | Ruby | mit | 216 | master | 1,273 | # frozen_string_literal: true
require "system_helper"
describe "Workspaces" do
fixtures :workspaces
before do
visit workspaces_path
expect(page).to have_text "Choose workspace"
end
it "I can open Demo workspace" do
click_on "Demo"
expect(page).to have_text "Demo Workspace"
expect(page).... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | spec/system/workspaces/show_spec.rb | Ruby | mit | 216 | master | 543 | # frozen_string_literal: true
require "system_helper"
describe "Workspaces -> Show" do
fixtures :workspaces
let(:workspace) { workspaces(:empty) }
it "I can open an existing workspace" do
visit workspace_path(workspace)
expect(page).to have_text "Just created workspace for fun"
expect(page).to ha... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | spec/system/workspaces/create_spec.rb | Ruby | mit | 216 | master | 352 | # frozen_string_literal: true
require "system_helper"
describe "Workspaces -> New" do
it "I can create a new workspace" do
visit new_workspace_path
fill_in "workspace[name]", with: "My Workspacer"
click_on "Create"
expect(page).to have_text "Welcome to your new workspace!"
expect(page).to have... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | spec/system/sessions/logout_spec.rb | Ruby | mit | 216 | master | 318 | # frozen_string_literal: true
require "system_helper"
describe "Log in" do
it "I can logout" do
visit root_path
within "nav" do
expect(page).to have_text "Welcome, Any!"
expect(page).to have_text "Sign out"
click_on "Sign out"
end
expect(page).to have_link "Sign in"
end
end |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | spec/system/sessions/login_spec.rb | Ruby | mit | 216 | master | 514 | # frozen_string_literal: true
require "system_helper"
describe "Log in", auth: false do
fixtures :workspaces
it "I should login before visiting the workspace" do
visit root_path
click_on "Demo"
expect(page).to have_text "Please, name yourself"
expect(page).to have_current_path(login_path)
... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | spec/system/lists/delete_spec.rb | Ruby | mit | 216 | master | 1,366 | # frozen_string_literal: true
require "system_helper"
describe "Workspaces -> List -> Delete" do
fixtures :workspaces, :lists
let(:workspace) { workspaces(:demo) }
let(:list) { lists(:demo_cables) }
before do
visit workspace_path(workspace)
expect(page).to have_text workspace.name
end
it "I del... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | spec/system/lists/create_spec.rb | Ruby | mit | 216 | master | 1,432 | # frozen_string_literal: true
require "system_helper"
describe "Workspaces -> New list" do
fixtures :workspaces
let(:workspace) { workspaces(:empty) }
before do
visit workspace_path(workspace)
expect(page).to have_text workspace.name
end
it "I can create a new list" do
within dom_id(workspace... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | spec/system/lists/items_spec.rb | Ruby | mit | 216 | master | 2,790 | # frozen_string_literal: true
require "system_helper"
describe "Workspaces -> List -> Items" do
fixtures :workspaces, :lists, :items
let(:workspace) { workspaces(:demo) }
let(:empty_list) { lists(:demo_empty) }
let(:full_list) { lists(:demo_cables) }
before do
visit workspace_path(workspace)
expec... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | spec/system/chat/messaging_spec.rb | Ruby | mit | 216 | master | 1,908 | # frozen_string_literal: true
require "system_helper"
describe "Workspaces -> Chat" do
fixtures :workspaces
before do
visit workspace_path(workspaces(:demo))
expect(page).to have_text "Demo Workspace"
expect(page).to have_css "#{dom_id(workspaces(:demo), "chat")}[connected]"
end
it "I can send a... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | spec/support/login_helpers.rb | Ruby | mit | 216 | master | 690 | # frozen_string_literal: true
module LoginHelpers
module System
def login_user(name)
page.driver.set_cookie(
:uid,
[name, Nanoid.generate(size: 3)].join("/"),
domain: CAPYBARA_COOKIE_DOMAIN
)
end
def logout() = page.driver.clear_cookies
end
module Controller
... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | spec/controllers/lists_controller_spec.rb | Ruby | mit | 216 | master | 1,167 | # frozen_string_literal: true
require "rails_helper"
describe ListsController do
fixtures :workspaces, :lists
let(:user) { User.generate("abby") }
let(:workspace) { workspaces(:demo) }
before { login user }
describe "POST #create" do
let(:form_params) { {name: "My TODO list"} }
subject { post :c... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | spec/controllers/items_controller_spec.rb | Ruby | mit | 216 | master | 1,668 | # frozen_string_literal: true
require "rails_helper"
describe ItemsController do
fixtures :workspaces, :lists, :items
let(:user) { User.generate("abby") }
let(:workspace) { workspaces(:demo) }
let(:list) { lists(:demo_cables) }
before { login user }
describe "POST #create" do
let(:form_params) { {d... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | config/routes.rb | Ruby | mit | 216 | master | 441 | # frozen_string_literal: true
Rails.application.routes.draw do
get "/login", to: "sessions#new", as: :login
post "/login", to: "sessions#create"
delete "/logout", to: "sessions#destroy", as: :logout
resources :workspaces, only: [:index, :new, :create, :destroy, :show] do
resources :lists, only: [:create, ... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | config/puma.rb | Ruby | mit | 216 | master | 1,628 | # frozen_string_literal: true
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for mini... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | config/boot.rb | Ruby | mit | 216 | master | 299 | # frozen_string_literal: true
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
require "bundler/setup" # Set up gems listed in the Gemfile.
require "bootsnap/setup" # Speed up boot time by caching expensive operations.
# Use edge Ruby syntax
require "ruby-next/language/runtime" |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | config/application.rb | Ruby | mit | 216 | master | 632 | # frozen_string_literal: true
require_relative "boot"
require "rails"
require "active_model/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_view/railtie"
require "action_cable/engine"
require "active_job/railtie"
require "active_support/core_ext/integer/time"
Bundler.req... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | config/environments/development.rb | Ruby | mit | 216 | master | 1,511 | # frozen_string_literal: true
Rails.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... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | config/environments/test.rb | Ruby | mit | 216 | master | 1,864 | # frozen_string_literal: true
# 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 suite and is wiped
# and recreated between test runs. Don't rely on the data there!
Rails.applic... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | config/environments/production.rb | Ruby | mit | 216 | master | 4,435 | # frozen_string_literal: true
Rails.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
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, a... |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | config/initializers/filter_parameter_logging.rb | Ruby | mit | 216 | master | 241 | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password, :token, :email] |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | db/schema.rb | Ruby | mit | 216 | master | 1,830 | # 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 | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | db/migrate/20200430123346_create_workspaces.rb | Ruby | mit | 216 | master | 258 | # frozen_string_literal: true
class CreateWorkspaces < ActiveRecord::Migration[6.0]
def change
create_table :workspaces do |t|
t.string :name, null: false
t.string :public_id, null: false, index: true
t.timestamps
end
end
end |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | db/migrate/20200504092152_create_items.rb | Ruby | mit | 216 | master | 320 | # frozen_string_literal: true
class CreateItems < ActiveRecord::Migration[6.0]
def change
create_table :items do |t|
t.belongs_to :list, null: false, foreign_key: true, index: true
t.text :desc, null: false
t.boolean :completed, null: false, default: false
t.timestamps
end
end
end |
github | anycable/anycable_rails_demo | https://github.com/anycable/anycable_rails_demo | db/migrate/20200504060319_create_lists.rb | Ruby | mit | 216 | master | 270 | # frozen_string_literal: true
class CreateLists < ActiveRecord::Migration[6.0]
def change
create_table :lists do |t|
t.string :name, null: false
t.belongs_to :workspace, null: false, index: true, foreign_key: true
t.timestamps
end
end
end |
github | st0012/ruby-lsp-rspec | https://github.com/st0012/ruby-lsp-rspec | Gemfile | Ruby | mit | 217 | main | 467 | # frozen_string_literal: true
source "https://rubygems.org"
# Specify your gem's dependencies in ruby-lsp-rspec.gemspec
gemspec
gem "rake", "~> 13.0"
gem "rspec", "~> 3.0"
gem "rubocop", "~> 1.21"
gem "rubocop-shopify", "~> 2.14", require: false
gem "rubocop-rake", "~> 0.6.0", require: false
gem "rubocop-sorbet",... |
github | st0012/ruby-lsp-rspec | https://github.com/st0012/ruby-lsp-rspec | ruby-lsp-rspec.gemspec | Ruby | mit | 217 | main | 1,407 | # frozen_string_literal: true
require_relative "lib/ruby_lsp_rspec/version"
Gem::Specification.new do |spec|
spec.name = "ruby-lsp-rspec"
spec.version = RubyLsp::RSpec::VERSION
spec.authors = ["Stan Lo"]
spec.email = ["stan001212@gmail.com"]
spec.summary = "RSpec addon for ruby-lsp"
spec.description = "R... |
github | st0012/ruby-lsp-rspec | https://github.com/st0012/ruby-lsp-rspec | spec/definition_spec.rb | Ruby | mit | 217 | main | 6,116 | # typed: false
# frozen_string_literal: true
require_relative "spec_helper"
RSpec.describe RubyLsp::RSpec do
include RubyLsp::TestHelper
describe "definition" do
it "finds the subject declaration" do
source = <<~RUBY
RSpec.describe Foo do
subject { 1 }
it "does something" d... |
github | st0012/ruby-lsp-rspec | https://github.com/st0012/ruby-lsp-rspec | spec/document_symbol_spec.rb | Ruby | mit | 217 | main | 11,945 | # typed: false
# frozen_string_literal: true
require_relative "spec_helper"
RSpec.describe RubyLsp::RSpec do
include RubyLsp::TestHelper
let(:uri) { URI("file:///fake_spec.rb") }
describe "document symbol" do
it "generates correct document symbols" do
source = <<~RUBY
RSpec.describe Foo do
... |
github | st0012/ruby-lsp-rspec | https://github.com/st0012/ruby-lsp-rspec | spec/spec_helper.rb | Ruby | mit | 217 | main | 544 | # frozen_string_literal: true
require "ruby-lsp-rspec"
require "ruby_lsp/internal"
require "ruby_lsp/test_helper"
require "ruby_lsp/ruby_lsp_rspec/addon"
require "ruby_lsp/ruby_lsp_rspec/test_discovery"
require "tempfile"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.ex... |
github | st0012/ruby-lsp-rspec | https://github.com/st0012/ruby-lsp-rspec | spec/test_discovery_spec.rb | Ruby | mit | 217 | main | 10,363 | # typed: false
# frozen_string_literal: true
require "spec_helper"
RSpec.describe RubyLsp::RSpec::TestDiscovery do
include RubyLsp::TestHelper
let(:uri) { URI("file://#{File.expand_path("fake_spec.rb", __dir__)}") }
describe "test discovery" do
it "discovers RSpec examples" do
source = <<~RUBY
... |
github | st0012/ruby-lsp-rspec | https://github.com/st0012/ruby-lsp-rspec | spec/spec_style_patch_spec.rb | Ruby | mit | 217 | main | 295 | # frozen_string_literal: true
RSpec.describe RubyLsp::Listeners::SpecStyle do
describe "spec_style_patch" do
it "disables initialization" do
RubyLsp::Listeners::SpecStyle.new(double("response_builder"), double("global_state"), double("dispatcher"), double("uri"))
end
end
end |
github | st0012/ruby-lsp-rspec | https://github.com/st0012/ruby-lsp-rspec | spec/addon_spec.rb | Ruby | mit | 217 | main | 3,520 | # frozen_string_literal: true
require "spec_helper"
RSpec.describe RubyLsp::RSpec::Addon do
include RubyLsp::TestHelper
let(:uri) { URI("file:///fake_spec.rb") }
let(:formatter_absolute_path) { described_class::FORMATTER_PATH }
let(:formatter_name) { described_class::FORMATTER_NAME }
describe "test comman... |
github | st0012/ruby-lsp-rspec | https://github.com/st0012/ruby-lsp-rspec | spec/rspec_formatter_spec.rb | Ruby | mit | 217 | main | 7,922 | # typed: false
# frozen_string_literal: true
require "spec_helper"
require "socket"
require "open3"
require "json"
require "stringio"
require "ruby_lsp/ruby_lsp_rspec/rspec_formatter"
RSpec.describe "RubyLsp::RSpec::RSpecFormatter" do
it "sends correct LSP events during test execution" do
fixture_path = File.ex... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.