Sha256: 2257209852488cc5842167b0500a2d763b3eb20c35beae35b51a12f629c20e8d

Contents?: true

Size: 906 Bytes

Versions: 5

Compression:

Stored size: 906 Bytes

Contents

# encoding: UTF-8

require 'spec_helper'

if (Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR >= 1) ||
    Rails::VERSION::MAJOR >= 6
  require 'rails/command'
  require 'rails/commands/console/console_command'
else
  require 'rails/commands/console'
end

describe PryRails::Railtie do
  it 'should start Pry instead of IRB and make the helpers available' do
    # Yes, I know this is horrible.
    begin
      $called_start = false
      real_pry = Pry

      silence_warnings do
        ::Pry = Class.new do
          def self.start(*)
            $called_start = true
          end
        end
      end

      Rails::Console.start(Rails.application)

      assert $called_start
    ensure
      silence_warnings do
        ::Pry = real_pry
      end
    end

    %w(app helper reload!).each do |helper|
      TOPLEVEL_BINDING.eval("respond_to?(:#{helper}, true)").must_equal true
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
pry-rails-0.3.11 spec/railtie_spec.rb
pry-rails-0.3.10 spec/railtie_spec.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/pry-rails-0.3.9/spec/railtie_spec.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/pry-rails-0.3.9/spec/railtie_spec.rb
pry-rails-0.3.9 spec/railtie_spec.rb