rspec-console 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5595f52cfc1378c93e5bbc27f208aa27d3800d3c
4
- data.tar.gz: 7812d579d4f5494fd90cbe52e103e8d174dcede8
3
+ metadata.gz: 8eae7534370fe97bef6518c88dffefcd8336ce60
4
+ data.tar.gz: f01040396dd1c53b22512230f50b4e534e576111
5
5
  SHA512:
6
- metadata.gz: 97ea965247d28cfa04a43c19e2fe24fd2b35abd47534f076677705ee7c77f4c30c66c44a95537d6792816cd911d4ff0f5652714dace14e15218a7d3bb531e613
7
- data.tar.gz: 1eb378a2c957226e729a50279ed33be7d913900b9cfe5518e875ff2a4e3932987768895fa5851cf6e92718004bbfa894a0adbd1d9d18a2263f3fc2d41ad15800
6
+ metadata.gz: 0f4ec3da898f9a48276fd6d1b1b79546309421620ce50886eb41517a1e595bd96d45afd5595a3347733eefbee31781422f15e862fc5ac5299df4aacfd488e442
7
+ data.tar.gz: 34205d017f5f3fe1894187a0f82cb4e9ee666cc8dc4bbb74a5cb621ff092bb81c85342448939a73283f9a0b2104083cf40df19476a0eee69d235bc24677ce539
data/README.md CHANGED
@@ -24,7 +24,7 @@ Ensure you turned off Rails's `cache_classes` in the config/environment/test.rb
24
24
  ```ruby
25
25
  Rails.application.configure do
26
26
  # turn off this!
27
- conig.cache_classes = false
27
+ config.cache_classes = false
28
28
  end
29
29
  ```
30
30
 
@@ -1,17 +1,29 @@
1
1
  module RSpecConsole::Pry
2
2
  def self.setup
3
- ::Pry::CommandSet.new do
4
- create_command "rspec", "Works pretty much like the regular rspec command" do
5
- group "Testing"
3
+ ::Pry::CommandSet.new(&method(:rspec_command))
4
+ .tap { |cmd| ::Pry::Commands.import cmd }
5
+ end
6
+
7
+ def self.rspec_command(cmd)
8
+ cmd.create_command "rspec", "Runs specs; to silence ActiveRecord output use SILENCE_AR=true" do
9
+ group "Testing"
6
10
 
7
- def process(*args)
8
- RSpecConsole::Runner.run(args)
9
- end
11
+ def process(*args)
12
+ with_ar_silenced { RSpecConsole::Runner.run(args) }
13
+ end
14
+
15
+ def with_ar_silenced(&block)
16
+ return block.call unless defined?(ActiveRecord) && ENV['SILENCE_AR']
17
+ old_logger, ActiveRecord::Base.logger = ActiveRecord::Base.logger, nil
18
+ block.call
19
+ ensure
20
+ ActiveRecord::Base.logger = old_logger
21
+ end
10
22
 
11
- def complete(input)
12
- super + Bond::Rc.files(input.split(" ").last || '')
13
- end
23
+ def complete(input)
24
+ require 'bond'
25
+ super + Bond::Rc.files(input.split(" ").last || '')
14
26
  end
15
- end.tap { |cmd| ::Pry::Commands.import cmd }
27
+ end
16
28
  end
17
29
  end
@@ -1,3 +1,3 @@
1
1
  module RSpecConsole
2
- VERSION = '0.5.0'
2
+ VERSION = '0.5.1'
3
3
  end
data/lib/rspec-console.rb CHANGED
@@ -18,7 +18,7 @@ module RSpecConsole
18
18
 
19
19
  # We only want the test env
20
20
  register_hook do
21
- if defined?(Rails) && !Rails.env.test?
21
+ if defined?(Rails) && !Rails.env =~ /test/
22
22
  raise "Rails env must be set as test (use `rails console test` to launch the console)."
23
23
  end
24
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-console
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Viennot