rspec-console 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/rspec-console/pry.rb +22 -10
- data/lib/rspec-console/version.rb +1 -1
- data/lib/rspec-console.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8eae7534370fe97bef6518c88dffefcd8336ce60
|
4
|
+
data.tar.gz: f01040396dd1c53b22512230f50b4e534e576111
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f4ec3da898f9a48276fd6d1b1b79546309421620ce50886eb41517a1e595bd96d45afd5595a3347733eefbee31781422f15e862fc5ac5299df4aacfd488e442
|
7
|
+
data.tar.gz: 34205d017f5f3fe1894187a0f82cb4e9ee666cc8dc4bbb74a5cb621ff092bb81c85342448939a73283f9a0b2104083cf40df19476a0eee69d235bc24677ce539
|
data/README.md
CHANGED
data/lib/rspec-console/pry.rb
CHANGED
@@ -1,17 +1,29 @@
|
|
1
1
|
module RSpecConsole::Pry
|
2
2
|
def self.setup
|
3
|
-
::Pry::CommandSet.new
|
4
|
-
|
5
|
-
|
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
|
-
|
8
|
-
|
9
|
-
|
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
|
-
|
12
|
-
|
13
|
-
|
23
|
+
def complete(input)
|
24
|
+
require 'bond'
|
25
|
+
super + Bond::Rc.files(input.split(" ").last || '')
|
14
26
|
end
|
15
|
-
end
|
27
|
+
end
|
16
28
|
end
|
17
29
|
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
|
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
|