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
drapergem/draper
https://github.com/drapergem/draper
spec/performance/models.rb
Ruby
mit
5,266
master
335
require "./performance/active_record" class Product < ActiveRecord::Base def self.sample_class_method "sample class method" end def hello_world "Hello, World" end end class FastProduct < ActiveRecord::Base def self.sample_class_method "sample class method" end def hello_world "Hello, Wo...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
Gemfile
Ruby
mit
5,256
main
480
source "https://gem.coop" gemspec eval_gemfile 'Gemfile-rspec-dependencies' gem 'yard', '~> 0.9.24', require: false group :documentation do gem 'github-markup', '~> 3.0.3' gem 'redcarpet', '~> 3.5.1', platforms: [:ruby] end gem 'capybara' gem 'ffi', '> 1.15.5' gem 'rake', '> 12' gem 'rubocop', '~> 1.28.2' cus...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
Rakefile
Ruby
mit
5,256
main
6,693
require "bundler" begin Bundler.setup Bundler::GemHelper.install_tasks rescue raise "You need to install a bundle first. Try 'thor version:use 3.2.13'" end require 'yaml' require 'rspec' require 'rspec/core/rake_task' require 'cucumber/rake/task' def rails_template_command require "rails/version" "app:templ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
rspec-rails.gemspec
Ruby
mit
5,256
main
2,393
$LOAD_PATH.unshift File.expand_path('lib', __dir__) require "rspec/rails/version" Gem::Specification.new do |s| s.name = "rspec-rails" s.version = RSpec::Rails::Version::STRING s.platform = Gem::Platform::RUBY s.license = "MIT" s.authors = ["David Chelimsky", "Andy Lindeman"] s.email ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
Thorfile
Ruby
mit
5,256
main
358
class Version < Thor include Thor::Actions desc "use VERSION", "installs the bundle the rails-VERSION" def use(version) remove_file "Gemfile.lock" run "echo '#{version}' > ./.rails-version" run "bundle install --binstubs" end desc "which", "print out the configured rails version" def which ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
features/step_definitions/additional_cli_steps.rb
Ruby
mit
5,256
main
1,264
begin require "active_job" rescue LoadError # rubocop:disable Lint/SuppressedException end begin require "action_cable" rescue LoadError # rubocop:disable Lint/SuppressedException end begin require "active_storage" require "action_mailbox" rescue LoadError # rubocop:disable Lint/SuppressedException end require...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
features/support/env.rb
Ruby
mit
5,256
main
2,139
require 'aruba/cucumber' require 'fileutils' module ArubaExt def run_command_and_stop(cmd, opts = {}) exec_cmd = cmd =~ /^rspec/ ? "bin/#{cmd}" : cmd unset_bundler_env_vars # Ensure the correct Gemfile and binstubs are found in_current_directory do with_unbundled_env do super(exec_cmd,...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
benchmarks/before_block_capture_block_vs_yield.rb
Ruby
mit
5,256
main
6,758
require 'benchmark/ips' def before_n_times(n, &block) n.times { instance_exec(&block) } end def yield_n_times(n) before_n_times(n) { yield } end def capture_block_and_yield_n_times(n, &block) # rubocop:disable Lint/UnusedMethodArgument before_n_times(n) { yield } end def capture_block_and_call_n_times(n, &blo...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
snippets/include_activesupport_testing_tagged_logger.rb
Ruby
mit
5,256
main
1,885
if __FILE__ =~ /^snippets/ fail "Snippets are supposed to be run from their own directory to avoid side " \ "effects as e.g. the root `Gemfile`, or `spec/spec_helpers.rb` to be " \ "loaded by the root `.rspec`." end # We opt-out from using RubyGems, but `bundler/inline` requires it require 'rubygems' ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
snippets/use_active_record_false.rb
Ruby
mit
5,256
main
1,681
if __FILE__ =~ /^snippets/ fail "Snippets are supposed to be run from their own directory to avoid side " \ "effects as e.g. the root `Gemfile`, or `spec/spec_helpers.rb` to be " \ "loaded by the root `.rspec`." end # We opt-out from using RubyGems, but `bundler/inline` requires it require 'rubygems' ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
snippets/avoid_fixture_name_collision.rb
Ruby
mit
5,256
main
1,534
if __FILE__ =~ /^snippets/ fail "Snippets are supposed to be run from their own directory to avoid side " \ "effects as e.g. the root `Gemfile`, or `spec/spec_helpers.rb` to be " \ "loaded by the root `.rspec`." end # We opt-out from using RubyGems, but `bundler/inline` requires it require 'rubygems' ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec-rails.rb
Ruby
mit
5,256
main
3,388
require 'rspec/rails/feature_check' # Namespace for all core RSpec projects. module RSpec # Namespace for rspec-rails code. module Rails # Railtie to hook into Rails. class Railtie < ::Rails::Railtie # As of Rails 5.1.0 you can register directories to work with `rake notes` require 'rails/sourc...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails.rb
Ruby
mit
5,256
main
578
require 'rspec/core' require 'rails/version' # Load any of our adapters and extensions early in the process require 'rspec/rails/adapters' require 'rspec/rails/extensions' # Load the rspec-rails parts require 'rspec/rails/view_rendering' require 'rspec/rails/matchers' require 'rspec/rails/fixture_support' require 'rs...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/adapters.rb
Ruby
mit
5,256
main
5,259
require 'delegate' require 'active_support' require 'active_support/concern' require 'active_support/core_ext/string' module RSpec module Rails # @private def self.disable_testunit_autorun # `Test::Unit::AutoRunner.need_auto_run=` was introduced to the test-unit # gem in version 2.4.9. Previous t...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/fixture_support.rb
Ruby
mit
5,256
main
2,120
module RSpec module Rails # @private module FixtureSupport if defined?(ActiveRecord::TestFixtures) extend ActiveSupport::Concern include RSpec::Rails::SetupAndTeardownAdapter include RSpec::Rails::MinitestLifecycleAdapter include RSpec::Rails::MinitestAssertionAdapter ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/active_record.rb
Ruby
mit
5,256
main
1,019
module RSpec module Rails # Fake class to document RSpec ActiveRecord configuration options. In practice, # these are dynamically added to the normal RSpec configuration object. class ActiveRecordConfiguration # @private def self.initialize_activerecord_configuration(config) config.bef...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/fixture_file_upload_support.rb
Ruby
mit
5,256
main
1,285
module RSpec module Rails # @private module FixtureFileUploadSupport delegate :fixture_file_upload, to: :rails_fixture_file_wrapper private # In Rails 7.0 fixture file path needs to be relative to `file_fixture_path` instead, this change # was brought in with a deprecation warning on 6...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/matchers.rb
Ruby
mit
5,256
main
1,037
require 'rspec/core/warnings' require 'rspec/expectations' require 'rspec/rails/feature_check' module RSpec module Rails # @api public # Container module for Rails specific matchers. module Matchers end end end require 'rspec/rails/matchers/base_matcher' require 'rspec/rails/matchers/have_rendered...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/configuration.rb
Ruby
mit
5,256
main
6,103
module RSpec module Rails # Fake class to document RSpec Rails configuration options. In practice, # these are dynamically added to the normal RSpec configuration object. class Configuration # @!method infer_spec_type_from_file_location! # Automatically tag specs in conventional directories wi...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/view_path_builder.rb
Ruby
mit
5,256
main
1,135
module RSpec module Rails # Builds paths for view specs using a particular route set. class ViewPathBuilder def initialize(route_set) self.class.send(:include, route_set.url_helpers) end # Given a hash of parameters, build a view path, if possible. # Returns nil if no path can...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/file_fixture_support.rb
Ruby
mit
5,256
main
479
require 'active_support/testing/file_fixtures' module RSpec module Rails # @private module FileFixtureSupport extend ActiveSupport::Concern include ActiveSupport::Testing::FileFixtures included do self.file_fixture_path = RSpec.configuration.file_fixture_path if defined?(Ac...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/feature_check.rb
Ruby
mit
5,256
main
1,136
module RSpec module Rails # @private module FeatureCheck module_function def has_active_job? defined?(::ActiveJob) end def has_active_record? defined?(::ActiveRecord) end def has_active_record_migration? has_active_record? && defined?(::ActiveRecor...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/example.rb
Ruby
mit
5,256
main
665
require 'rspec/rails/example/rails_example_group' require 'rspec/rails/example/controller_example_group' require 'rspec/rails/example/request_example_group' require 'rspec/rails/example/helper_example_group' require 'rspec/rails/example/view_example_group' require 'rspec/rails/example/mailer_example_group' require 'rsp...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/view_spec_methods.rb
Ruby
mit
5,256
main
1,902
module RSpec module Rails # Adds methods (generally to ActionView::TestCase::TestController). # Intended for use in view specs. module ViewSpecMethods module_function # Adds methods `extra_params=` and `extra_params` to the indicated class. # When class is `::ActionView::TestCase::TestC...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/version.rb
Ruby
mit
5,256
main
206
module RSpec module Rails # Version information for RSpec Rails. module Version # Current version of RSpec Rails, in semantic versioning format. STRING = '8.1.0.pre' end end end
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/view_assigns.rb
Ruby
mit
5,256
main
631
module RSpec module Rails # Helpers for making instance variables available to views. module ViewAssigns # Assigns a value to an instance variable in the scope of the # view being rendered. # # @example # # assign(:widget, stub_model(Widget)) def assign(key, value...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/view_rendering.rb
Ruby
mit
5,256
main
4,649
require 'action_view/testing/resolvers' module RSpec module Rails # @api public # Helpers for optionally rendering views in controller specs. module ViewRendering extend ActiveSupport::Concern # @!attribute [r] # Returns the controller object instance under test. attr_reader :con...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/matchers/be_a_new.rb
Ruby
mit
5,256
main
2,565
module RSpec module Rails module Matchers # @api private # # Matcher class for `be_a_new`. Should not be instantiated directly. # # @see RSpec::Rails::Matchers#be_a_new class BeANew < RSpec::Rails::Matchers::BaseMatcher # @private def initialize(expected) ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/matchers/base_matcher.rb
Ruby
mit
5,256
main
5,567
module RSpec module Rails module Matchers # @api private # # Base class to build matchers. Should not be instantiated directly. class BaseMatcher include RSpec::Matchers::Composable # @api private # Used to detect when no arg is passed to `initialize`. # `n...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/matchers/redirect_to.rb
Ruby
mit
5,256
main
958
module RSpec module Rails module Matchers # Matcher for redirects. module RedirectTo # @private class RedirectTo < RSpec::Rails::Matchers::BaseMatcher def initialize(scope, expected) @expected = expected @scope = scope end def matc...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/matchers/be_valid.rb
Ruby
mit
5,256
main
1,325
module RSpec module Rails module Matchers # @private class BeValid < RSpec::Matchers::BuiltIn::Be def initialize(*args) @args = args end def matches?(actual) @actual = actual actual.valid?(*@args) end def failure_message ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/matchers/routing_matchers.rb
Ruby
mit
5,256
main
4,128
module RSpec module Rails module Matchers # Matchers to help with specs for routing code. module RoutingMatchers extend RSpec::Matchers::DSL # @private class RouteToMatcher < RSpec::Rails::Matchers::BaseMatcher def initialize(scope, *expected) @scope = sc...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/matchers/be_new_record.rb
Ruby
mit
5,256
main
713
module RSpec module Rails module Matchers # @private class BeANewRecord < RSpec::Rails::Matchers::BaseMatcher def matches?(actual) actual.new_record? end def failure_message "expected #{actual.inspect} to be a new record, but was persisted" end ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/matchers/relation_match_array.rb
Ruby
mit
5,256
main
254
if defined?(ActiveRecord::Relation) && defined?(RSpec::Matchers::BuiltIn::OperatorMatcher) # RSpec 4 removed OperatorMatcher RSpec::Matchers::BuiltIn::OperatorMatcher.register(ActiveRecord::Relation, '=~', RSpec::Matchers::BuiltIn::ContainExactly) end
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/matchers/have_http_status.rb
Ruby
mit
5,256
main
14,550
# The following code inspired and modified from Rails' `assert_response`: # # https://github.com/rails/rails/blob/main/actionpack/lib/action_dispatch/testing/assertions/response.rb#L22-L38 # # Thank you to all the Rails devs who did the heavy lifting on this! module RSpec module Rails module Matchers # N...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/matchers/have_rendered.rb
Ruby
mit
5,256
main
2,108
module RSpec module Rails module Matchers # Matcher for template rendering. module RenderTemplate # @private class RenderTemplateMatcher < RSpec::Rails::Matchers::BaseMatcher def initialize(scope, expected, message = nil) @expected = Symbol === expected ? expected...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/matchers/have_enqueued_mail.rb
Ruby
mit
5,256
main
8,493
# We require the minimum amount of rspec-mocks possible to avoid # conflicts with other mocking frameworks. # See: https://github.com/rspec/rspec-rails/issues/2252 require "rspec/mocks/argument_matchers" require "rspec/rails/matchers/active_job" # rubocop: disable Metrics/ClassLength module RSpec module Rails mo...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/matchers/active_job.rb
Ruby
mit
5,256
main
17,536
require "active_job/base" require "active_job/arguments" module RSpec module Rails module Matchers # Namespace for various implementations of ActiveJob features # # @api private module ActiveJob # rubocop: disable Metrics/ClassLength # @private class Base < RSpec::...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/matchers/action_mailbox.rb
Ruby
mit
5,256
main
2,089
module RSpec module Rails module Matchers # Namespace for various implementations of ActionMailbox features # # @api private module ActionMailbox # @private class Base < RSpec::Rails::Matchers::BaseMatcher private def create_inbound_email(message) ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/matchers/action_cable.rb
Ruby
mit
5,256
main
2,338
require "rspec/rails/matchers/action_cable/have_broadcasted_to" module RSpec module Rails module Matchers extend RSpec::Matchers::DSL # Namespace for various implementations of ActionCable features # # @api private module ActionCable end # @api public # Passes if...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/matchers/send_email.rb
Ruby
mit
5,256
main
3,132
# frozen_string_literal: true module RSpec module Rails module Matchers # @api private # # Matcher class for `send_email`. Should not be instantiated directly. # # @see RSpec::Rails::Matchers#send_email class SendEmail < RSpec::Rails::Matchers::BaseMatcher # @api priva...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/matchers/action_cable/have_streams.rb
Ruby
mit
5,256
main
1,715
module RSpec module Rails module Matchers module ActionCable # @api private # Provides the implementation for `have_stream`, `have_stream_for`, and `have_stream_from`. # Not intended to be instantiated directly. class HaveStream < RSpec::Matchers::BuiltIn::BaseMatcher ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/matchers/action_cable/have_broadcasted_to.rb
Ruby
mit
5,256
main
5,078
module RSpec module Rails module Matchers module ActionCable # rubocop: disable Metrics/ClassLength # @private class HaveBroadcastedTo < RSpec::Matchers::BuiltIn::BaseMatcher def initialize(target, channel:) @target = target @channel = channel ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/extensions/active_record/proxy.rb
Ruby
mit
5,256
main
528
RSpec.configure do |rspec| # Delay this in order to give users a chance to configure `expect_with`... rspec.before(:suite) do if defined?(RSpec::Matchers) && RSpec::Matchers.configuration.respond_to?(:syntax) && # RSpec 4 dropped support for monkey-patching `should` syntax RSpec::Matchers.config...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/example/controller_example_group.rb
Ruby
mit
5,256
main
7,432
module RSpec module Rails # @private ControllerAssertionDelegator = RSpec::Rails::AssertionDelegator.new( ActionDispatch::Assertions::RoutingAssertions ) # @api public # Container module for controller spec functionality. module ControllerExampleGroup extend ActiveSupport::Concern...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/example/request_example_group.rb
Ruby
mit
5,256
main
732
module RSpec module Rails # @api public # Container class for request spec functionality. module RequestExampleGroup extend ActiveSupport::Concern include RSpec::Rails::RailsExampleGroup include ActionDispatch::Integration::Runner include ActionDispatch::Assertions include RS...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/example/rails_example_group.rb
Ruby
mit
5,256
main
783
# Temporary workaround to resolve circular dependency between rspec-rails' spec # suite and ammeter. require 'rspec/rails/matchers' require 'active_support/current_attributes/test_helper' require 'active_support/execution_context/test_helper' module RSpec module Rails # @api public # Common rails example fu...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/example/mailbox_example_group.rb
Ruby
mit
5,256
main
2,145
module RSpec module Rails # @api public # Container module for mailbox spec functionality. module MailboxExampleGroup extend ActiveSupport::Concern if RSpec::Rails::FeatureCheck.has_action_mailbox? require 'action_mailbox/test_helper' extend ::ActionMailbox::TestHelper ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/example/view_example_group.rb
Ruby
mit
5,256
main
7,259
require 'rspec/rails/view_assigns' require 'rspec/rails/view_spec_methods' require 'rspec/rails/view_path_builder' module RSpec module Rails # @api public # Container class for view spec functionality. module ViewExampleGroup extend ActiveSupport::Concern include RSpec::Rails::RailsExampleGro...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/example/channel_example_group.rb
Ruby
mit
5,256
main
3,101
require "rspec/rails/matchers/action_cable/have_streams" module RSpec module Rails # @api public # Container module for channel spec functionality. It is only available if # ActionCable has been loaded before it. module ChannelExampleGroup # @private module ClassMethods # These bl...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/example/mailer_example_group.rb
Ruby
mit
5,256
main
1,109
module RSpec module Rails # @api public # Container module for mailer spec functionality. It is only available if # ActionMailer has been loaded before it. module MailerExampleGroup # This blank module is only necessary for YARD processing. It doesn't # handle the conditional `defined?` ch...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/example/helper_example_group.rb
Ruby
mit
5,256
main
1,096
require 'rspec/rails/view_assigns' module RSpec module Rails # @api public # Container module for helper specs. module HelperExampleGroup extend ActiveSupport::Concern include RSpec::Rails::RailsExampleGroup include ActionView::TestCase::Behavior include RSpec::Rails::ViewAssigns ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/example/model_example_group.rb
Ruby
mit
5,256
main
312
module RSpec module Rails # @api public # Container class for model spec functionality. Does not provide anything # special over the common RailsExampleGroup currently. module ModelExampleGroup extend ActiveSupport::Concern include RSpec::Rails::RailsExampleGroup end end end
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/example/job_example_group.rb
Ruby
mit
5,256
main
602
module RSpec module Rails # @api public # Container module for job spec functionality. It is only available if # ActiveJob has been loaded before it. module JobExampleGroup # This blank module is only necessary for YARD processing. It doesn't # handle the conditional `defined?` check below...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/example/routing_example_group.rb
Ruby
mit
5,256
main
1,689
module RSpec module Rails # @private RoutingAssertionDelegator = RSpec::Rails::AssertionDelegator.new( ActionDispatch::Assertions::RoutingAssertions ) # @api public # Container module for routing spec functionality. module RoutingExampleGroup extend ActiveSupport::Concern i...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/example/system_example_group.rb
Ruby
mit
5,256
main
5,435
module RSpec module Rails # @api public # Container class for system tests module SystemExampleGroup extend ActiveSupport::Concern include RSpec::Rails::RailsExampleGroup include RSpec::Rails::Matchers::RedirectTo include RSpec::Rails::Matchers::RenderTemplate include ActionD...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/example/feature_example_group.rb
Ruby
mit
5,256
main
1,617
module RSpec module Rails # @api public # Container module for routing spec functionality. module FeatureExampleGroup extend ActiveSupport::Concern include RSpec::Rails::RailsExampleGroup # Default host to be used in Rails route helpers if none is specified. DEFAULT_HOST = "www.ex...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/rspec/rails/tasks/rspec.rake
Ruby
mit
5,256
main
1,347
require 'rspec/core/rake_task' if default = Rake.application.instance_variable_get('@tasks')['default'] default.prerequisites.delete('test') end task default: :spec if ::Rails::VERSION::STRING < "8.0.0" task stats: "spec:statsetup" end desc "Run all specs in spec directory (excluding plugin specs)" RSpec::Core::...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec.rb
Ruby
mit
5,256
main
1,406
require 'rails/generators/named_base' require 'rspec/core' require 'rspec/rails/feature_check' # @private # Weirdly named generators namespace (should be `RSpec`) for compatibility with # rails loading. module Rspec # @private module Generators # @private class Base < ::Rails::Generators::NamedBase i...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/model/model_generator.rb
Ruby
mit
5,256
main
903
require 'generators/rspec' module Rspec module Generators # @private class ModelGenerator < Base argument :attributes, type: :array, default: [], banner: "field:type field:type" class_option :fixture, type: :boolean def create_model_spec ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/helper/helper_generator.rb
Ruby
mit
5,256
main
380
require 'generators/rspec' module Rspec module Generators # @private class HelperGenerator < Base class_option :helper_specs, type: :boolean, default: true def generate_helper_spec return unless options[:helper_specs] template 'helper_spec.rb', target_path('helpers', class_path,...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/helper/templates/helper_spec.rb
Ruby
mit
5,256
main
521
require 'rails_helper' # Specs in this file have access to a helper object that includes # the <%= class_name %>Helper. For example: # # describe <%= class_name %>Helper do # describe "string concat" do # it "concats two strings with spaces" do # expect(helper.concat_strings("this","that")).to eq("this tha...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/generator/generator_generator.rb
Ruby
mit
5,256
main
538
require 'generators/rspec' module Rspec module Generators # @private class GeneratorGenerator < Base class_option :generator_specs, type: :boolean, default: true, desc: 'Generate generator specs' def generate_generator_spec return unless options[:generator_specs] template templa...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/system/system_generator.rb
Ruby
mit
5,256
main
509
require 'generators/rspec' module Rspec module Generators # @private class SystemGenerator < Base class_option :system_specs, type: :boolean, default: true, desc: "Generate system specs" def generate_system_spec return unless options[:system_specs] template template_name, targe...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/system/templates/system_spec.rb
Ruby
mit
5,256
main
206
require 'rails_helper' RSpec.describe "<%= class_name.pluralize %>", <%= type_metatag(:system) %> do before do driven_by(:rack_test) end pending "add some scenarios (or delete) #{__FILE__}" end
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/view/view_generator.rb
Ruby
mit
5,256
main
596
require 'generators/rspec' module Rspec module Generators # @private class ViewGenerator < Base argument :actions, type: :array, default: [], banner: "action action" class_option :template_engine, desc: "Template engine to generate view files" def create_view_specs empty_directory...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/feature/feature_generator.rb
Ruby
mit
5,256
main
783
require 'generators/rspec' module Rspec module Generators # @private class FeatureGenerator < Base class_option :feature_specs, type: :boolean, default: true, desc: "Generate feature specs" class_option :singularize, type: :boolean, default: false, desc: "Singularize the generated feature" ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/controller/controller_generator.rb
Ruby
mit
5,256
main
1,814
require 'generators/rspec' module Rspec module Generators # @private class ControllerGenerator < Base argument :actions, type: :array, default: [], banner: "action action" class_option :template_engine, desc: "Template engine to generate view files" class_option :request_specs, type: :...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/controller/templates/controller_spec.rb
Ruby
mit
5,256
main
350
require 'rails_helper' <% module_namespacing do -%> RSpec.describe <%= class_name %>Controller, <%= type_metatag(:controller) %> do <% for action in actions -%> describe "GET #<%= action %>" do it "returns http success" do get :<%= action %> expect(response).to have_http_status(:success) end e...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/controller/templates/request_spec.rb
Ruby
mit
5,256
main
559
require 'rails_helper' RSpec.describe "<%= class_name.pluralize %>", <%= type_metatag(:request) %> do <% namespaced_path = regular_class_path.join('/') -%> <% if actions.empty? -%> describe "GET /index" do pending "add some examples (or delete) #{__FILE__}" end <% end -%> <% for action in actions -%> describ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/controller/templates/routing_spec.rb
Ruby
mit
5,256
main
386
require 'rails_helper' <% module_namespacing do -%> RSpec.describe '<%= class_name %>Controller', <%= type_metatag(:routing) %> do describe 'routing' do <% for action in actions -%> it 'routes to #<%= action %>' do expect(get: "/<%= class_name.underscore %>/<%= action %>").to route_to("<%= class_name.under...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/controller/templates/view_spec.rb
Ruby
mit
5,256
main
203
require 'rails_helper' RSpec.describe "<%= file_name %>/<%= @action %>.html.<%= options[:template_engine] %>", <%= type_metatag(:view) %> do pending "add some examples to (or delete) #{__FILE__}" end
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/request/request_generator.rb
Ruby
mit
5,256
main
432
require 'generators/rspec' module Rspec module Generators # @private class RequestGenerator < Base class_option :request_specs, type: :boolean, default: true, desc: 'Generate request specs' def generate_request_spec return unless options[:request_specs] template 'request_spec.rb...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/request/templates/request_spec.rb
Ruby
mit
5,256
main
305
require 'rails_helper' RSpec.describe "<%= class_name.pluralize %>", <%= type_metatag(:request) %> do describe "GET /<%= name.underscore.pluralize %>" do it "works! (now write some real specs)" do get <%= index_helper %>_path expect(response).to have_http_status(200) end end end
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/mailer/mailer_generator.rb
Ruby
mit
5,256
main
1,006
require 'generators/rspec' require "rspec/rails/feature_check" module Rspec module Generators # @private class MailerGenerator < Base argument :actions, type: :array, default: [], banner: "method method" def generate_mailer_spec file_suffix = file_name.end_with?('mailer') ? 'spec.rb' : '...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/mailer/templates/mailer_spec.rb
Ruby
mit
5,256
main
707
require "rails_helper" <% module_namespacing do -%> RSpec.describe <%= class_name.sub(/(Mailer)?$/, 'Mailer') %>, <%= type_metatag(:mailer) %> do <% for action in actions -%> describe "<%= action %>" do let(:mail) { <%= class_name.sub(/(Mailer)?$/, 'Mailer') %>.<%= action %> } it "renders the headers" do ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/mailer/templates/preview.rb
Ruby
mit
5,256
main
471
<% module_namespacing do -%> # Preview all emails at http://localhost:3000/rails/mailers/<%= file_path %>_mailer class <%= class_name %><%= 'Mailer' unless class_name.end_with?('Mailer') %>Preview < ActionMailer::Preview <% actions.each do |action| -%> # Preview this email at http://localhost:3000/rails/mailers/<%= ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/install/install_generator.rb
Ruby
mit
5,256
main
2,166
require "rspec/support" require "rspec/core" RSpec::Support.require_rspec_core "project_initializer" require "rspec/rails/feature_check" module Rspec module Generators # @private class InstallGenerator < ::Rails::Generators::Base desc <<DESC Description: Copy rspec files to your application. DESC ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/install/templates/spec/rails_helper.rb
Ruby
mit
5,256
main
3,956
# This file is copied to spec/ when you run 'rails generate rspec:install' require 'spec_helper' ENV['RAILS_ENV'] ||= 'test' require_relative '../config/environment' # Prevent database truncation if the environment is production abort("The Rails environment is running in production mode!") if Rails.env.production? <% i...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/channel/channel_generator.rb
Ruby
mit
5,256
main
276
require 'generators/rspec' module Rspec module Generators # @private class ChannelGenerator < Base def create_channel_spec template 'channel_spec.rb.erb', target_path('channels', class_path, "#{file_name}_channel_spec.rb") end end end end
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/authentication/authentication_generator.rb
Ruby
mit
5,256
main
530
require 'generators/rspec' module Rspec module Generators # @private class AuthenticationGenerator < Base def initialize(args, *options) args.replace(['User']) super end def create_user_spec template 'user_spec.rb', target_path('models', 'user_spec.rb') end ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/job/job_generator.rb
Ruby
mit
5,256
main
341
require 'generators/rspec' module Rspec module Generators # @private class JobGenerator < Base def create_job_spec file_suffix = file_name.end_with?('job') ? 'spec.rb' : 'job_spec.rb' template 'job_spec.rb.erb', target_path('jobs', class_path, [file_name, file_suffix].join('_')) e...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/mailbox/mailbox_generator.rb
Ruby
mit
5,256
main
304
require 'generators/rspec' module Rspec module Generators # @private class MailboxGenerator < Base def create_mailbox_spec template('mailbox_spec.rb.erb', target_path('mailboxes', class_path, "#{file_name}_mailbox_spec.rb") ) end end end end
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/scaffold/scaffold_generator.rb
Ruby
mit
5,256
main
4,259
require 'generators/rspec' require 'rails/generators/resource_helpers' module Rspec module Generators # @private class ScaffoldGenerator < Base include ::Rails::Generators::ResourceHelpers source_paths << File.expand_path('../helper/templates', __dir__) argument :attributes, type: :array, d...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/scaffold/templates/controller_spec.rb
Ruby
mit
5,256
main
5,882
require 'rails_helper' # This spec was generated by rspec-rails when you ran the scaffold generator. # It demonstrates how one might use RSpec to specify the controller code that # was generated by Rails when you ran the scaffold generator. # # It assumes that the implementation code is generated by the rails scaffold...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/scaffold/templates/request_spec.rb
Ruby
mit
5,256
main
5,024
require 'rails_helper' # This spec was generated by rspec-rails when you ran the scaffold generator. # It demonstrates how one might use RSpec to test the controller code that # was generated by Rails when you ran the scaffold generator. # # It assumes that the implementation code is generated by the rails scaffold # ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/scaffold/templates/edit_spec.rb
Ruby
mit
5,256
main
1,119
require 'rails_helper' <% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%> RSpec.describe "<%= ns_table_name %>/edit", <%= type_metatag(:view) %> do let(:<%= singular_table_name %>) { <%= class_name %>.create!(<%= ')' if output_attributes.empty? ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/scaffold/templates/index_spec.rb
Ruby
mit
5,256
main
1,082
require 'rails_helper' <% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%> RSpec.describe "<%= ns_table_name %>/index", <%= type_metatag(:view) %> do before(:each) do assign(:<%= table_name %>, [ <% [1,2].each_with_index do |id, model_index| -%> ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/scaffold/templates/api_controller_spec.rb
Ruby
mit
5,256
main
5,547
require 'rails_helper' # This spec was generated by rspec-rails when you ran the scaffold generator. # It demonstrates how one might use RSpec to specify the controller code that # was generated by Rails when you ran the scaffold generator. # # It assumes that the implementation code is generated by the rails scaffold...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/scaffold/templates/api_request_spec.rb
Ruby
mit
5,256
main
5,330
require 'rails_helper' # This spec was generated by rspec-rails when you ran the scaffold generator. # It demonstrates how one might use RSpec to test the controller code that # was generated by Rails when you ran the scaffold generator. # # It assumes that the implementation code is generated by the rails scaffold # ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/scaffold/templates/show_spec.rb
Ruby
mit
5,256
main
783
require 'rails_helper' <% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%> RSpec.describe "<%= ns_table_name %>/show", <%= type_metatag(:view) %> do before(:each) do assign(:<%= singular_table_name %>, <%= class_name %>.create!(<%= '))' if output...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/scaffold/templates/new_spec.rb
Ruby
mit
5,256
main
1,013
require 'rails_helper' <% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%> RSpec.describe "<%= ns_table_name %>/new", <%= type_metatag(:view) %> do before(:each) do assign(:<%= singular_table_name %>, <%= class_name %>.new(<%= '))' if output_attr...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
lib/generators/rspec/scaffold/templates/routing_spec.rb
Ruby
mit
5,256
main
1,383
require "rails_helper" <% module_namespacing do -%> RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:routing) %> do describe "routing" do <% unless options[:singleton] -%> it "routes to #index" do expect(get: "/<%= ns_table_name %>").to route_to("<%= ns_table_name %>#index") end...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/spec_helper.rb
Ruby
mit
5,256
main
3,149
require 'rails/all' module RSpecRails class Application < ::Rails::Application config.secret_key_base = 'ASecretString' # Force this to be considered initialized, # this silences warnings in our specs def initialized? = true if defined?(ActionCable) ActionCable.server.config.cable = { "ad...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/sanity_check_spec.rb
Ruby
mit
5,256
main
1,654
require 'pathname' RSpec.describe "Verify required rspec dependencies" do tmp_root = Pathname.new(RSpec::Core::RubyProject.root).join("tmp") before { FileUtils.mkdir_p tmp_root } def with_clean_env if Bundler.respond_to?(:with_unbundled_env) Bundler.with_unbundled_env { yield } else Bundle...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/support/group_failure_formatter.rb
Ruby
mit
5,256
main
432
module RSpec::Rails::TestSupport class FailureReporter def initialize @exceptions = [] end attr_reader :exceptions def example_failed(example) @exceptions << example.exception end def method_missing(name, *_args, &_block) end end def failure_reporter @failure_reporte...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/support/generators.rb
Ruby
mit
5,256
main
3,394
module RSpec module Rails module Specs module Generators module Macros # Tell the generator where to put its output (what it thinks of as # Rails.root) def set_default_destination destination File.expand_path('../../tmp', __dir__) end de...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/support/ar_classes.rb
Ruby
mit
5,256
main
1,338
ActiveRecord::Base.establish_connection( adapter: 'sqlite3', database: ':memory:' ) module Connections def self.extended(host) fields = { host.primary_key => "integer PRIMARY KEY AUTOINCREMENT" } fields.merge!(host.connection_fields) if host.respond_to?(:connection_fields) host.connection.exe...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/support/shared_examples.rb
Ruby
mit
5,256
main
3,202
require 'pathname' RSpec.shared_examples_for "an rspec-rails example group mixin" do |type, *paths| let(:mixin) { described_class } def define_group_in(path, group_definition) path = Pathname(path) $_new_group = nil begin file = path + "whatever_spec.rb" Dir.mktmpdir("rspec-rails-app-root...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/generators/rspec/system/system_generator_spec.rb
Ruby
mit
5,256
main
964
# Generators are not automatically loaded by rails require 'generators/rspec/system/system_generator' require 'support/generators' RSpec.describe Rspec::Generators::SystemGenerator, type: :generator do setup_default_destination describe "system specs" do subject(:system_spec) { file("spec/system/posts_spec.rb...