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
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/generators/rspec/feature/feature_generator_spec.rb
Ruby
mit
5,256
main
1,916
# Generators are not automatically loaded by rails require 'generators/rspec/feature/feature_generator' require 'support/generators' RSpec.describe Rspec::Generators::FeatureGenerator, type: :generator do setup_default_destination describe 'feature specs' do describe 'are generated independently from the comm...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/generators/rspec/scaffold/scaffold_generator_spec.rb
Ruby
mit
5,256
main
20,033
# Generators are not automatically loaded by Rails require 'generators/rspec/scaffold/scaffold_generator' require 'support/generators' require 'rspec/support/spec/in_sub_process' RSpec.describe Rspec::Generators::ScaffoldGenerator, type: :generator do include RSpec::Support::InSubProcess setup_default_destination ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/generators/rspec/view/view_generator_spec.rb
Ruby
mit
5,256
main
1,386
# Generators are not automatically loaded by Rails require 'generators/rspec/view/view_generator' require 'support/generators' RSpec.describe Rspec::Generators::ViewGenerator, type: :generator do setup_default_destination describe 'with default template engine' do it 'generates a spec for the supplied action'...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/generators/rspec/controller/controller_generator_spec.rb
Ruby
mit
5,256
main
6,923
# Generators are not automatically loaded by Rails require 'generators/rspec/controller/controller_generator' require 'support/generators' RSpec.describe Rspec::Generators::ControllerGenerator, type: :generator do setup_default_destination describe 'request specs' do subject(:filename) { file('spec/requests/p...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/generators/rspec/generator/generator_generator_spec.rb
Ruby
mit
5,256
main
562
require 'generators/rspec/generator/generator_generator' require 'support/generators' RSpec.describe Rspec::Generators::GeneratorGenerator, type: :generator do setup_default_destination describe "generator specs" do subject(:generator_spec) { file("spec/generator/posts_generator_spec.rb") } before do ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/generators/rspec/job/job_generator_spec.rb
Ruby
mit
5,256
main
971
# Generators are not automatically loaded by Rails require 'generators/rspec/job/job_generator' require 'support/generators' RSpec.describe Rspec::Generators::JobGenerator, type: :generator, skip: !RSpec::Rails::FeatureCheck.has_active_job? do setup_default_destination describe 'the generated files' do before...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/generators/rspec/helper/helper_generator_spec.rb
Ruby
mit
5,256
main
807
# Generators are not automatically loaded by Rails require 'generators/rspec/helper/helper_generator' require 'support/generators' RSpec.describe Rspec::Generators::HelperGenerator, type: :generator do setup_default_destination subject(:helper_spec) { file('spec/helpers/posts_helper_spec.rb') } describe 'gener...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/generators/rspec/model/model_generator_spec.rb
Ruby
mit
5,256
main
894
# Generators are not automatically loaded by Rails require 'generators/rspec/model/model_generator' require 'support/generators' RSpec.describe Rspec::Generators::ModelGenerator, type: :generator do setup_default_destination it 'runs both the model and fixture tasks' do gen = generator %w[posts] expect(ge...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/generators/rspec/mailbox/mailbox_generator_spec.rb
Ruby
mit
5,256
main
645
# Generators are not automatically loaded by Rails require 'generators/rspec/mailbox/mailbox_generator' require 'support/generators' RSpec.describe Rspec::Generators::MailboxGenerator, type: :generator, skip: !RSpec::Rails::FeatureCheck.has_action_mailbox? do setup_default_destination describe 'the generated file...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/generators/rspec/request/request_generator_spec.rb
Ruby
mit
5,256
main
283
# Generators are not automatically loaded by Rails require 'generators/rspec/request/request_generator' require 'support/generators' RSpec.describe Rspec::Generators::RequestGenerator, type: :generator do setup_default_destination it_behaves_like "a request spec generator" end
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/generators/rspec/mailer/mailer_generator_spec.rb
Ruby
mit
5,256
main
2,368
# Generators are not automatically loaded by Rails require 'generators/rspec/mailer/mailer_generator' require 'support/generators' RSpec.describe Rspec::Generators::MailerGenerator, type: :generator do setup_default_destination describe 'mailer spec' do subject(:filename) { file('spec/mailers/posts_mailer_spe...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/generators/rspec/install/install_generator_spec.rb
Ruby
mit
5,256
main
3,834
# Generators are not automatically loaded by Rails require 'generators/rspec/install/install_generator' require 'support/generators' RSpec.describe Rspec::Generators::InstallGenerator, type: :generator do def use_active_record_migration match(/ActiveRecord::Migration\./m) end def content_for(file_name) ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/generators/rspec/channel/channel_generator_spec.rb
Ruby
mit
5,256
main
582
# Generators are not automatically loaded by Rails require "generators/rspec/channel/channel_generator" require 'support/generators' RSpec.describe Rspec::Generators::ChannelGenerator, type: :generator, skip: !RSpec::Rails::FeatureCheck.has_action_cable_testing? do setup_default_destination before { run_generator...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/generators/rspec/authentication/authentication_generator_spec.rb
Ruby
mit
5,256
main
927
# Generators are not automatically loaded by Rails require 'generators/rspec/authentication/authentication_generator' require 'support/generators' RSpec.describe Rspec::Generators::AuthenticationGenerator, type: :generator do setup_default_destination it 'runs both the model and fixture tasks' do gen = genera...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails_spec.rb
Ruby
mit
5,256
main
733
require 'rspec/support/spec/library_wide_checks' RSpec.describe "RSpec::Rails" do include RSpec::Support::WhitespaceChecks # Pasted from rspec-support lib/rspec/support/spec/library_wide_checks.rb:134 # Easier to do that here than to extract it out RSpec::Matchers.define :be_well_formed do match do |actua...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/view_rendering_spec.rb
Ruby
mit
5,256
main
5,737
module RSpec::Rails RSpec.describe ViewRendering, :with_isolated_config do let(:group) do RSpec::Core::ExampleGroup.describe do def controller ActionController::Base.new end include ViewRendering end end context "default" do context "ActionController::B...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/fixture_support_spec.rb
Ruby
mit
5,256
main
2,218
module RSpec::Rails RSpec.describe FixtureSupport, :with_isolated_config do context "with use_transactional_fixtures set to false" do it "still supports fixture_path/fixture_paths" do allow(RSpec.configuration).to receive(:use_transactional_fixtures) { false } group = RSpec::Core::ExampleGro...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/view_spec_methods_spec.rb
Ruby
mit
5,256
main
2,149
module RSpec::Rails RSpec.describe ViewSpecMethods do before do class ::VCSampleClass; end end after do Object.send(:remove_const, :VCSampleClass) end describe ".add_extra_params_accessors_to" do describe "when accessors are not yet defined" do it "adds them as instance...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/minitest_lifecycle_adapter_spec.rb
Ruby
mit
5,256
main
1,065
RSpec.describe RSpec::Rails::MinitestLifecycleAdapter, :with_isolated_config do it "invokes minitest lifecycle hooks at the appropriate times" do invocations = [] example_group = RSpec::Core::ExampleGroup.describe("MinitestHooks") do include RSpec::Rails::MinitestLifecycleAdapter define_method(:b...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/assertion_adapter_spec.rb
Ruby
mit
5,256
main
913
RSpec.describe RSpec::Rails::MinitestAssertionAdapter do include RSpec::Rails::MinitestAssertionAdapter RSpec::Rails::Assertions.public_instance_methods.select { |m| m.to_s =~ /^(assert|flunk|refute)/ }.each do |m| if m.to_s == "assert_equal" it "exposes #{m} to host examples" do assert_equal 3, ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/configuration_spec.rb
Ruby
mit
5,256
main
9,808
require 'rspec/support/spec/in_sub_process' RSpec.describe "Configuration" do include RSpec::Support::InSubProcess subject(:config) { RSpec::Core::Configuration.new } before do RSpec::Rails.initialize_configuration(config) end it "adds 'vendor/' to the backtrace exclusions" do expect(config.backtr...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/active_record_spec.rb
Ruby
mit
5,256
main
1,315
RSpec.describe "ActiveRecord support" do around do |ex| old_value = RSpec::Mocks.configuration.verify_partial_doubles? ex.run RSpec::Mocks.configuration.verify_partial_doubles = old_value end RSpec.shared_examples_for "stubbing ActiveRecord::Base" do it "allows you to stub `ActiveRecord::Base`" d...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/active_model_spec.rb
Ruby
mit
5,256
main
1,236
RSpec.describe "ActiveModel support" do around do |ex| old_value = RSpec::Mocks.configuration.verify_partial_doubles? ex.run RSpec::Mocks.configuration.verify_partial_doubles = old_value end RSpec.shared_examples_for "stubbing ActiveModel" do before do stub_const 'ActiveRecord' unless defin...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/assertion_delegator_spec.rb
Ruby
mit
5,256
main
1,014
RSpec.describe RSpec::Rails::AssertionDelegator do it "provides a module that delegates assertion methods to an isolated class" do klass = Class.new { include RSpec::Rails::AssertionDelegator.new(RSpec::Rails::Assertions) } expect(klass.new).to respond_to(:assert) end it "delegates back to the...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/fixture_file_upload_support_spec.rb
Ruby
mit
5,256
main
1,680
module RSpec::Rails RSpec.describe FixtureFileUploadSupport, :with_isolated_config do context 'with fixture paths set in config' do it 'resolves fixture file' do RSpec.configuration.fixture_paths = [File.dirname(__FILE__)] expect_to_pass fixture_file_upload_resolved('fixture_file_upload_supp...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/setup_and_teardown_adapter_spec.rb
Ruby
mit
5,256
main
1,968
RSpec.describe RSpec::Rails::SetupAndTeardownAdapter, :with_isolated_config do describe ".setup" do it "registers before hooks in the order setup is received" do group = RSpec::Core::ExampleGroup.describe do include RSpec::Rails::SetupAndTeardownAdapter def self.foo; "foo"; end def s...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/example/helper_example_group_spec.rb
Ruby
mit
5,256
main
2,571
module RSpec::Rails RSpec.describe HelperExampleGroup, :with_isolated_config do module ::FoosHelper class InternalClass end end subject { HelperExampleGroup } it_behaves_like "an rspec-rails example group mixin", :helper, './spec/helpers/', '.\\spec\\helpers\\' i...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/example/routing_example_group_spec.rb
Ruby
mit
5,256
main
716
module RSpec::Rails RSpec.describe RoutingExampleGroup, :with_isolated_config do it_behaves_like "an rspec-rails example group mixin", :routing, './spec/routing/', '.\\spec\\routing\\' describe "named routes" do it "delegates them to the route_set" do group = RSpec::Core::Ex...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/example/mailer_example_group_spec.rb
Ruby
mit
5,256
main
220
module RSpec::Rails RSpec.describe MailerExampleGroup, :with_isolated_config do it_behaves_like "an rspec-rails example group mixin", :mailer, './spec/mailers/', '.\\spec\\mailers\\' end end
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/example/channel_example_group_spec.rb
Ruby
mit
5,256
main
332
require "rspec/rails/feature_check" module RSpec::Rails RSpec.describe ChannelExampleGroup, :with_isolated_config do if RSpec::Rails::FeatureCheck.has_action_cable_testing? it_behaves_like "an rspec-rails example group mixin", :channel, './spec/channels/', '.\\spec\\channels\\' en...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/example/job_example_group_spec.rb
Ruby
mit
5,256
main
246
module RSpec::Rails RSpec.describe JobExampleGroup, :with_isolated_config do if defined?(ActiveJob) it_behaves_like "an rspec-rails example group mixin", :job, './spec/jobs/', '.\\spec\\jobs\\' end end end
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/example/controller_example_group_spec.rb
Ruby
mit
5,256
main
7,903
class ::ApplicationController def self.abstract?; false; end end module RSpec::Rails RSpec.describe ControllerExampleGroup, :with_isolated_config do it_behaves_like "an rspec-rails example group mixin", :controller, './spec/controllers/', '.\\spec\\controllers\\' def group_for(klass) ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/example/feature_example_group_spec.rb
Ruby
mit
5,256
main
1,852
module RSpec::Rails RSpec.describe FeatureExampleGroup, :with_isolated_config do it_behaves_like "an rspec-rails example group mixin", :feature, './spec/features/', '.\\spec\\features\\' it "includes Rails route helpers" do with_isolated_stderr do Rails.application.routes.dr...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/example/model_example_group_spec.rb
Ruby
mit
5,256
main
215
module RSpec::Rails RSpec.describe ModelExampleGroup, :with_isolated_config do it_behaves_like "an rspec-rails example group mixin", :model, './spec/models/', '.\\spec\\models\\' end end
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/example/system_example_group_spec.rb
Ruby
mit
5,256
main
5,806
module RSpec::Rails RSpec.describe SystemExampleGroup, :with_isolated_config do it_behaves_like "an rspec-rails example group mixin", :system, './spec/system/', '.\\spec\\system\\' describe '#method_name' do it 'converts special characters to underscores' do group = RSpec::C...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/example/request_example_group_spec.rb
Ruby
mit
5,256
main
345
module RSpec::Rails RSpec.describe RequestExampleGroup, :with_isolated_config do it_behaves_like "an rspec-rails example group mixin", :request, './spec/requests/', '.\\spec\\requests\\', './spec/integration/', '.\\spec\\integration\\', './spec/api/', '....
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/example/rails_example_group_spec.rb
Ruby
mit
5,256
main
2,030
module RSpec::Rails RSpec.describe RailsExampleGroup, :with_isolated_config do it 'supports tagged_logger' do expect(described_class.private_instance_methods).to include(:tagged_logger) end it 'does not leak context between example groups' do groups = [ RSpec::Core::ExampleG...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/example/mailbox_example_group_spec.rb
Ruby
mit
5,256
main
2,368
require "rspec/rails/feature_check" class ApplicationMailbox class << self attr_accessor :received def receive(*) self.received += 1 end end self.received = 0 end module RSpec module Rails RSpec.describe MailboxExampleGroup, :with_isolated_config, skip: !RSpec::Rails::FeatureCheck.has_...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/example/view_example_group_spec.rb
Ruby
mit
5,256
main
11,765
require 'support/group_failure_formatter' module RSpec::Rails RSpec.describe ViewExampleGroup, :with_isolated_config do it_behaves_like "an rspec-rails example group mixin", :view, './spec/views/', '.\\spec\\views\\' describe 'automatic inclusion of helpers' do module ::ThingsHelpe...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/matchers/has_spec.rb
Ruby
mit
5,256
main
673
class CollectionOwner < ActiveRecord::Base connection.execute <<-SQL CREATE TABLE collection_owners ( id integer PRIMARY KEY AUTOINCREMENT ) SQL has_many :associated_items do def has_some_quality?; true end end end class AssociatedItem < ActiveRecord::Base connection.execute <<-SQL CREA...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/matchers/have_http_status_spec.rb
Ruby
mit
5,256
main
17,115
RSpec.describe "have_http_status" do def create_response(opts = {}) ActionDispatch::TestResponse.new(opts.fetch(:status)).tap { |x| x.request = ActionDispatch::Request.new({}) } end shared_examples_for "supports different response instances" do context "given an ActionDispatch::Response" do ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/matchers/be_valid_spec.rb
Ruby
mit
5,256
main
1,993
require 'rspec/rails/matchers/be_valid' RSpec.describe "be_valid matcher" do class Post include ActiveModel::Validations attr_accessor :title validates_presence_of :title end class Book def valid? false end def errors ['the spine is broken', 'the pages are dog-eared'] en...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/matchers/have_rendered_spec.rb
Ruby
mit
5,256
main
4,550
%w[have_rendered render_template].each do |template_expectation| RSpec.describe template_expectation do include RSpec::Rails::Matchers::RenderTemplate let(:response) { ActionDispatch::TestResponse.new } context "given a hash" do def assert_template(*); end it "delegates to assert_template" do...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/matchers/active_job_spec.rb
Ruby
mit
5,256
main
27,976
require "rspec/rails/feature_check" if RSpec::Rails::FeatureCheck.has_active_job? require "rspec/rails/matchers/active_job" class GlobalIdModel include GlobalID::Identification attr_reader :id def self.find(id) new(id) end def initialize(id) @id = id end def ==(comparis...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/matchers/action_mailbox_spec.rb
Ruby
mit
5,256
main
1,376
require "rspec/rails/feature_check" class ApplicationMailbox class Router def match_to_mailbox(*) Inbox end end def self.router Router.new end end class Inbox < ApplicationMailbox; end class Otherbox < ApplicationMailbox; end RSpec.describe "ActionMailbox matchers", skip: !RSpec::Rails::Fe...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/matchers/relation_match_array_spec.rb
Ruby
mit
5,256
main
686
RSpec.describe "ActiveSupport::Relation match_array matcher" do before { MockableModel.delete_all } let!(:models) { Array.new(3) { MockableModel.create } } it "verifies that the scope returns the records on the right hand side, regardless of order" do expect(MockableModel.all).to match_array(models.reverse)...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/matchers/be_new_record_spec.rb
Ruby
mit
5,256
main
747
RSpec.describe "be_new_record" do context "a new record" do let(:record) { double('record', new_record?: true) } it "passes" do expect(record).to be_new_record end it "fails with custom failure message" do expect { expect(record).not_to be_new_record }.to raise_exception(/e...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/matchers/redirect_to_spec.rb
Ruby
mit
5,256
main
2,088
require "active_support" require "active_support/test_case" RSpec.describe "redirect_to" do include RSpec::Rails::Matchers::RedirectTo let(:response) { ActionDispatch::TestResponse.new } context "with should" do context "when assert_redirected_to passes" do def assert_redirected_to(*); end it ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/matchers/route_to_spec.rb
Ruby
mit
5,256
main
5,784
RSpec.describe "route_to" do include RSpec::Rails::Matchers::RoutingMatchers include RSpec::Rails::Matchers::RoutingMatchers::RouteHelpers def assert_recognizes(*) # no-op end it "provides a description" do matcher = route_to("these" => "options") matcher.matches?(get: "path") description =...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/matchers/be_a_new_spec.rb
Ruby
mit
5,256
main
6,657
RSpec.describe "be_a_new matcher" do context "new record" do let(:record) do Class.new do def new_record?; true; end end.new end context "right class" do it "passes" do expect(record).to be_a_new(record.class) end end context "wrong class" do it "fails...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/matchers/send_email_spec.rb
Ruby
mit
5,256
main
5,587
RSpec.describe "send_email" do let(:mailer) do Class.new(ActionMailer::Base) do self.delivery_method = :test def test_email mail( from: "from@example.com", cc: "cc@example.com", bcc: "bcc@example.com", to: "to@example.com", subject: "Test emai...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/matchers/be_routable_spec.rb
Ruby
mit
5,256
main
1,753
RSpec.describe "be_routable" do include RSpec::Rails::Matchers::RoutingMatchers attr_reader :routes before { @routes = double("routes") } it "provides a description" do expect(be_routable.description).to eq("be routable") end context "with should" do it "passes if routes recognize the path" do ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/matchers/have_enqueued_mail_spec.rb
Ruby
mit
5,256
main
18,147
require "rspec/rails/feature_check" if RSpec::Rails::FeatureCheck.has_active_job? require "action_mailer" require "rspec/rails/matchers/have_enqueued_mail" class GlobalIDArgument include GlobalID::Identification def id; 1; end def to_global_id(options = {}); super(options.merge(app: 'rspec-rails'));...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/matchers/action_cable/have_broadcasted_to_spec.rb
Ruby
mit
5,256
main
8,859
require "rspec/rails/feature_check" if RSpec::Rails::FeatureCheck.has_action_cable_testing? require "rspec/rails/matchers/action_cable" class CableGlobalIdModel include GlobalID::Identification attr_reader :id def initialize(id) @id = id end def to_global_id(_options = {}) @glob...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
spec/rspec/rails/matchers/action_cable/have_stream_spec.rb
Ruby
mit
5,256
main
5,089
require "rspec/rails/feature_check" if RSpec::Rails::FeatureCheck.has_action_cable_testing? class StreamModel < Struct.new(:id) def to_gid_param "StreamModel##{id}" end end class StreamChannel < ActionCable::Channel::Base def self.channel_name "broadcast" end def subscribed ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
example_app_generator/run_specs.rb
Ruby
mit
5,256
main
577
run('bin/rspec spec -f doc') || abort # Ensure we test the issue in-case this isn't the first spec file loaded run( 'bin/rspec --backtrace -f doc spec/__verify_fixture_load_order_spec.rb' ) || abort run('bin/rake --backtrace spec') || abort run('bin/rake --backtrace spec:requests') || abort run('bin/rake --backtrace ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
example_app_generator/generate_stuff.rb
Ruby
mit
5,256
main
4,879
require 'rspec/rails/feature_check' DEFAULT_SOURCE_PATH = File.expand_path(__dir__) module ExampleAppHooks module AR def source_paths @__source_paths__ ||= [DEFAULT_SOURCE_PATH] end def setup_tasks # no-op end def final_tasks copy_file 'spec/verify_active_record_spec.rb' ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
example_app_generator/generate_action_mailer_specs.rb
Ruby
mit
5,256
main
1,159
require 'active_support' require 'active_support/core_ext/module' using_source_path(File.expand_path(__dir__)) do # Comment out the default mailer stuff comment_lines 'config/environments/development.rb', /action_mailer/ comment_lines 'config/environments/test.rb', /action_mailer/ initializer 'action_mailer.r...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
example_app_generator/generate_app.rb
Ruby
mit
5,256
main
2,428
require 'nokogiri' rspec_rails_repo_path = File.expand_path('..', __dir__) rspec_dependencies_gemfile = File.join(rspec_rails_repo_path, 'Gemfile-rspec-dependencies') rails_dependencies_gemfile = File.join(rspec_rails_repo_path, 'Gemfile-rails-dependencies') bundle_install_path = File.join(rspec_rails_repo_path, '..',...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
example_app_generator/spec/verify_mailer_preview_path_spec.rb
Ruby
mit
5,256
main
5,388
require 'rails_helper' require 'rspec/rails/feature_check' RSpec.describe 'Action Mailer railtie hook' do CaptureExec = Struct.new(:io, :exit_status) do def ==(str) io == str end end def as_commandline(ops) cmd, ops = ops.reverse ops ||= {} cmd_parts = ops.map { |k, v| "#{k}=#{v}" } <<...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
example_app_generator/spec/__verify_fixture_load_order_spec.rb
Ruby
mit
5,256
main
207
# This spec needs to be run before `rails_helper` is loaded to check the issue RSpec.describe "Verify issue rspec/rspec-rails#1355" do it "passes" do expect(1).to eq 1 end end require 'rails_helper'
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
example_app_generator/spec/verify_custom_renderers_spec.rb
Ruby
mit
5,256
main
3,455
require 'rails_helper' RSpec.describe "template rendering", type: :controller do context "without render_views" do context "with the standard renderers" do controller do def index render template: 'foo', layout: false end end it "renders the 'foo' template" do ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
example_app_generator/spec/verify_fixture_warning_spec.rb
Ruby
mit
5,256
main
1,508
require 'rails_helper' RSpec.describe "Fixture warnings" do def generate_fixture_example_group(hook_type) RSpec.describe do include RSpec::Rails::RailsExampleGroup fixtures :things before(hook_type) do things :a end it "" do end end end it "Warns when a fix...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
example_app_generator/spec/verify_view_path_stub_spec.rb
Ruby
mit
5,256
main
426
require 'rails_helper' RSpec.describe "verify view path doesn't leak stubs between examples", type: :view, order: :defined do subject(:html) do render partial: "example" rendered end it "renders the stub template" do stub_template("_example.html.erb" => "STUB_HTML") expect(html).to include("STUB...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
example_app_generator/spec/features/model_mocks_integration_spec.rb
Ruby
mit
5,256
main
426
require 'rails_helper' RSpec.describe "Using rspec-mocks with models" do it "supports stubbing class methods on models" do allow(Widget).to receive(:all).and_return(:any_stub) expect(Widget.all).to be :any_stub end it "supports stubbing attribute methods on models" do a_widget = Widget.new allow...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
example_app_generator/no_active_record/app/models/in_memory/model.rb
Ruby
mit
5,256
main
1,749
raise "ActiveRecord is defined but should not be!" if defined?(::ActiveRecord) require 'active_model' module InMemory module Persistence def all @all_records ||= [] end def count all.length end alias_method :size, :count alias_method :length, :count def last all.last ...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
example_app_generator/no_active_record/spec/verify_no_fixture_setup_spec.rb
Ruby
mit
5,256
main
629
# Pretend that ActiveRecord::Rails is defined and this doesn't blow up # with `config.use_active_record = false`. # Trick the other spec that checks that ActiveRecord is # *not* defined by wrapping it in RSpec::Rails namespace # so that it's reachable from RSpec::Rails::FixtureSupport. # NOTE: this has to be defined be...
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
example_app_generator/no_active_record/spec/verify_fixture_file_upload_spec.rb
Ruby
mit
5,256
main
241
require 'rails_helper' RSpec.describe 'Example App', :use_fixtures, type: :model do it 'supports fixture file upload' do file = fixture_file_upload(__FILE__) expect(file.read).to match(/RSpec\.describe 'Example App'/im) end end
github
rspec/rspec-rails
https://github.com/rspec/rspec-rails
example_app_generator/no_active_record/lib/rails/generators/in_memory/model/model_generator.rb
Ruby
mit
5,256
main
772
# Hook into the work already done to support older Rails require 'generators/rspec' module InMemory module Generators class ModelGenerator < ::Rspec::Generators::Base source_root File.expand_path('templates', __dir__) desc "Creates a Fake ActiveRecord acting model" argument :attributes, ...
github
rails/thor
https://github.com/rails/thor
Gemfile
Ruby
mit
5,240
main
367
source "https://rubygems.org" gem "rake" group :development do gem "pry" gem "pry-byebug" gem "rubocop", "~> 1.30" end group :test do gem "childlabor" gem "coveralls_reborn", "~> 0.23.1", require: false gem "rspec", ">= 3.2" gem "rspec-mocks", ">= 3" gem "simplecov", ">= 0.13" gem "webmock", ">= 3....
github
rails/thor
https://github.com/rails/thor
Thorfile
Ruby
mit
5,240
main
703
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__) require "bundler" require "thor/rake_compat" class Default < Thor include Thor::RakeCompat Bundler::GemHelper.install_tasks desc "build", "Build thor-#{Thor::VERSION}.gem into the pkg directory" def build Rake::Task["build"].execute end desc "i...
github
rails/thor
https://github.com/rails/thor
thor.gemspec
Ruby
mit
5,240
main
1,222
# coding: utf-8 lib = File.expand_path("../lib/", __FILE__) $LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib) require "thor/version" Gem::Specification.new do |spec| spec.name = "thor" spec.version = Thor::VERSION spec.licenses = %w(MIT) spec.authors = ["Yehuda Katz", "José Valim"] spec.email = "ruby-th...
github
rails/thor
https://github.com/rails/thor
spec/group_spec.rb
Ruby
mit
5,240
main
7,645
require "helper" describe Thor::Group do describe "command" do it "allows to use private methods from parent class as commands" do expect(ChildGroup.start).to eq(%w(bar foo baz)) expect(ChildGroup.new.baz("bar")).to eq("bar") end end describe "#start" do it "invokes all the commands unde...
github
rails/thor
https://github.com/rails/thor
spec/command_spec.rb
Ruby
mit
5,240
main
3,011
require "helper" describe Thor::Command do def command(options = {}, usage = "can_has") options.each do |key, value| options[key] = Thor::Option.parse(key, value) end @command ||= Thor::Command.new(:can_has, "I can has cheezburger", "I can has cheezburger\nLots and lots of it", nil, usage, options...
github
rails/thor
https://github.com/rails/thor
spec/rake_compat_spec.rb
Ruby
mit
5,240
main
1,618
require "helper" require "thor/rake_compat" require "rake/tasklib" $main = self class RakeTask < Rake::TaskLib def initialize define end def define $main.instance_eval do desc "Say it's cool" task :cool do puts "COOL" end namespace :hiper_mega do task :super do ...
github
rails/thor
https://github.com/rails/thor
spec/encoding_spec.rb
Ruby
mit
5,240
main
744
require "helper" require "thor/base" describe "file's encoding" do def load_thorfile(filename) Thor::Util.load_thorfile(File.expand_path("./fixtures/#{filename}", __dir__)) end it "respects explicit UTF-8" do load_thorfile("encoding_with_utf8.thor") expect(capture(:stdout) { Thor::Sandbox::Encoding...
github
rails/thor
https://github.com/rails/thor
spec/register_spec.rb
Ruby
mit
5,240
main
5,818
require "helper" class BoringVendorProvidedCLI < Thor desc "boring", "do boring stuff" def boring puts "bored. <yawn>" end end class ExcitingPluginCLI < Thor desc "hooray", "say hooray!" def hooray puts "hooray!" end desc "fireworks", "exciting fireworks!" def fireworks puts "kaboom!" e...
github
rails/thor
https://github.com/rails/thor
spec/base_spec.rb
Ruby
mit
5,240
main
11,716
require "helper" require "thor/base" class Amazing desc "hello", "say hello" def hello puts "Hello" end end describe Thor::Base do describe "#initialize" do it "sets arguments array" do base = MyCounter.new [1, 2] expect(base.first).to eq(1) expect(base.second).to eq(2) end ...
github
rails/thor
https://github.com/rails/thor
spec/exit_condition_spec.rb
Ruby
mit
5,240
main
434
require "helper" require "thor/base" describe "Exit conditions" do it "exits 0, not bubble up EPIPE, if EPIPE is raised" do epiped = false command = Class.new(Thor) do desc "my_action", "testing EPIPE" define_method :my_action do epiped = true raise Errno::EPIPE end end...
github
rails/thor
https://github.com/rails/thor
spec/thor_spec.rb
Ruby
mit
5,240
main
31,133
require "helper" describe Thor do describe "#method_option" do it "sets options to the next method to be invoked" do args = %w(foo bar --force) _, options = MyScript.start(args) expect(options).to eq("force" => true) end describe ":lazy_default" do it "is absent when option is no...
github
rails/thor
https://github.com/rails/thor
spec/helper.rb
Ruby
mit
5,240
main
2,036
$TESTING = true require "simplecov" require "coveralls" SimpleCov.formatters = [SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter] SimpleCov.start do add_filter "/spec" minimum_coverage(90) end $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib")) require "thor" require "thor/gro...
github
rails/thor
https://github.com/rails/thor
spec/script_exit_status_spec.rb
Ruby
mit
5,240
main
880
describe "when the Thor class's exit_with_failure? method returns true" do def thor_command(command) gem_dir= File.expand_path("#{File.dirname(__FILE__)}/..") lib_path= "#{gem_dir}/lib" script_path= "#{gem_dir}/spec/fixtures/exit_status.thor" ruby_lib= ENV["RUBYLIB"].nil? ? lib_path : "#{lib_path}:#{E...
github
rails/thor
https://github.com/rails/thor
spec/nested_context_spec.rb
Ruby
mit
5,240
main
423
require "helper" describe Thor::NestedContext do subject(:context) { described_class.new } describe "#enter" do it "is never empty within the entered block" do context.enter do context.enter {} expect(context).to be_entered end end it "is empty when outside of all blocks"...
github
rails/thor
https://github.com/rails/thor
spec/sort_spec.rb
Ruby
mit
5,240
main
1,436
require "helper" describe Thor do def shell @shell ||= Thor::Base.shell.new end describe "#sort - default" do my_script = Class.new(Thor) do desc "a", "First Command" def a; end desc "z", "Last Command" def z; end end before do @content = capture(:stdout) { my_scr...
github
rails/thor
https://github.com/rails/thor
spec/quality_spec.rb
Ruby
mit
5,240
main
2,045
describe "The library itself" do def check_for_spec_defs_with_single_quotes(filename) failing_lines = [] File.readlines(filename).each_with_index do |line, number| failing_lines << number + 1 if line =~ /^ *(describe|it|context) {1}'{1}/ end "#{filename} uses inconsistent single quotes on line...
github
rails/thor
https://github.com/rails/thor
spec/tree_spec.rb
Ruby
mit
5,240
main
1,401
require "helper" require "thor" class TreeApp < Thor desc "command1", "A top level command" def command1 end desc "command2", "Another top level command" def command2 end class SubApp < Thor desc "subcommand1", "A subcommand" def subcommand1 end end desc "sub", "Subcommands" subco...
github
rails/thor
https://github.com/rails/thor
spec/subcommand_spec.rb
Ruby
mit
5,240
main
2,685
require "helper" describe Thor do describe "#subcommand" do it "maps a given subcommand to another Thor subclass" do barn_help = capture(:stdout) { Scripts::MyDefaults.start(%w(barn)) } expect(barn_help).to include("barn help [COMMAND] # Describe subcommands or one specific subcommand") end ...
github
rails/thor
https://github.com/rails/thor
spec/line_editor_spec.rb
Ruby
mit
5,240
main
1,344
require "helper" require "readline" describe Thor::LineEditor, "on a system with Readline support" do before do @original_readline = ::Readline Object.send(:remove_const, :Readline) ::Readline = double("Readline") end after do Object.send(:remove_const, :Readline) ::Readline = @original_read...
github
rails/thor
https://github.com/rails/thor
spec/no_warnings_spec.rb
Ruby
mit
5,240
main
484
require "open3" context "when $VERBOSE is enabled" do it "prints no warnings" do root = File.expand_path("..", __dir__) _, err, = Open3.capture3("ruby -I #{root}/lib #{root}/spec/fixtures/verbose.thor") expect(err).to be_empty end it "prints no warnings even when erroring" do root = File.expand...
github
rails/thor
https://github.com/rails/thor
spec/runner_spec.rb
Ruby
mit
5,240
main
9,968
require "helper" require "thor/runner" describe Thor::Runner do def when_no_thorfiles_exist old_dir = Dir.pwd Dir.chdir ".." delete = Thor::Base.subclasses.select { |e| e.namespace == "default" } delete.each { |e| Thor::Base.subclasses.delete e } yield Thor::Base.subclasses.concat delete ...
github
rails/thor
https://github.com/rails/thor
spec/actions_spec.rb
Ruby
mit
5,240
main
13,886
require "helper" describe Thor::Actions do def runner(options = {}) @runner ||= MyCounter.new([1], options, destination_root: destination_root) end def action(*args, &block) capture(:stdout) { runner.send(*args, &block) } end def file File.join(destination_root, "foo") end describe "on inc...
github
rails/thor
https://github.com/rails/thor
spec/shell_spec.rb
Ruby
mit
5,240
main
1,243
require "helper" describe Thor::Shell do def shell @shell ||= Thor::Base.shell.new end describe "#initialize" do it "sets shell value" do base = MyCounter.new [1, 2], {}, shell: shell expect(base.shell).to eq(shell) end it "sets the base value on the shell if an accessor is availabl...
github
rails/thor
https://github.com/rails/thor
spec/invocation_spec.rb
Ruby
mit
5,240
main
3,791
require "helper" require "thor/base" describe Thor::Invocation do describe "#invoke" do it "invokes a command inside another command" do expect(capture(:stdout) { A.new.invoke(:two) }).to eq("2\n3\n") end it "invokes a command just once" do expect(capture(:stdout) { A.new.invoke(:one) }).to ...
github
rails/thor
https://github.com/rails/thor
spec/util_spec.rb
Ruby
mit
5,240
main
7,889
require "helper" module Thor::Util def self.clear_user_home! @@user_home = nil end end describe Thor::Util do describe "#find_by_namespace" do it "returns 'default' if no namespace is given" do expect(Thor::Util.find_by_namespace("")).to eq(Scripts::MyDefaults) end it "adds 'default' if n...
github
rails/thor
https://github.com/rails/thor
spec/actions/file_manipulation_spec.rb
Ruby
mit
5,240
main
25,896
require "helper" describe Thor::Actions do def runner(options = {}, behavior = :invoke) @runner ||= MyCounter.new([1], options, destination_root: destination_root, behavior: behavior) end def action(*args, &block) capture(:stdout) { runner.send(*args, &block) } end def exists_and_identical?(source,...
github
rails/thor
https://github.com/rails/thor
spec/actions/inject_into_file_spec.rb
Ruby
mit
5,240
main
13,938
# encoding: utf-8 require "helper" require "thor/actions" describe Thor::Actions::InjectIntoFile do before do ::FileUtils.rm_rf(destination_root) ::FileUtils.cp_r(source_root, destination_root) end def invoker(options = {}) @invoker ||= MyCounter.new([1, 2], options, destination_root: destination_ro...
github
rails/thor
https://github.com/rails/thor
spec/actions/create_file_spec.rb
Ruby
mit
5,240
main
6,876
require "helper" require "thor/actions" describe Thor::Actions::CreateFile do before do @silence = false ::FileUtils.rm_rf(destination_root) end def create_file(destination = nil, config = {}, options = {}, contents = "CONFIGURATION") @base = MyCounter.new([1, 2], options, destination_root: destinat...
github
rails/thor
https://github.com/rails/thor
spec/actions/empty_directory_spec.rb
Ruby
mit
5,240
main
3,667
require "helper" require "thor/actions" describe Thor::Actions::EmptyDirectory do before do ::FileUtils.rm_rf(destination_root) end def empty_directory(destination, options = {}) @action = Thor::Actions::EmptyDirectory.new(base, destination) end def invoke! capture(:stdout) { @action.invoke! } ...
github
rails/thor
https://github.com/rails/thor
spec/actions/directory_spec.rb
Ruby
mit
5,240
main
6,130
require "tmpdir" require "helper" require "thor/actions" describe Thor::Actions::Directory do before do ::FileUtils.rm_rf(destination_root) allow(invoker).to receive(:file_name).and_return("rdoc") end def invoker @invoker ||= WhinyGenerator.new([1, 2], {}, destination_root: destination_root) end ...
github
rails/thor
https://github.com/rails/thor
spec/actions/create_link_spec.rb
Ruby
mit
5,240
main
3,257
require "helper" require "thor/actions" require "tempfile" describe Thor::Actions::CreateLink, unless: windows? do before do @hardlink_to = File.join(Dir.tmpdir, "linkdest.rb") ::FileUtils.rm_rf(destination_root) ::FileUtils.rm_rf(@hardlink_to) end let(:config) { {} } let(:options) { {} } let(:...