web-console 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of web-console might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.markdown +15 -2
- data/lib/web_console/engine.rb +4 -2
- data/lib/web_console/repl/irb.rb +2 -1
- data/lib/web_console/version.rb +1 -1
- data/test/dummy/config/application.rb +1 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +413 -0
- data/test/dummy/log/test.log +17253 -0
- data/test/web_console/repl/irb_test.rb +51 -0
- metadata +2 -4
- data/test/dummy/tmp/pids/server.pid +0 -1
@@ -4,6 +4,22 @@ class IRBTest < ActiveSupport::TestCase
|
|
4
4
|
setup do
|
5
5
|
@irb1 = @irb = WebConsole::REPL::IRB.new
|
6
6
|
@irb2 = WebConsole::REPL::IRB.new
|
7
|
+
|
8
|
+
# Flag to signalize that the .irbrc was read.
|
9
|
+
$IRBRC_EXECUTED = false
|
10
|
+
|
11
|
+
# Since IRB is kinda funky, it reads the .irbrc in $HOME/.irbrc earlier
|
12
|
+
# that the one in the current working directory, we have to lie to it.
|
13
|
+
@preserved_home, ENV['HOME'] = ENV['HOME'], nil
|
14
|
+
|
15
|
+
# It also caches the procedure used to generate the .irbrc location.
|
16
|
+
IRB.conf[:RC_NAME_GENERATOR] = nil
|
17
|
+
end
|
18
|
+
|
19
|
+
teardown do
|
20
|
+
# Now, bring the working place as we have found it.
|
21
|
+
ENV['HOME'] = @preserved_home
|
22
|
+
WebConsole::Engine.config.web_console.prevent_irbrc_execution = false
|
7
23
|
end
|
8
24
|
|
9
25
|
test 'sending input returns the result as output' do
|
@@ -73,6 +89,23 @@ class IRBTest < ActiveSupport::TestCase
|
|
73
89
|
end
|
74
90
|
end
|
75
91
|
|
92
|
+
test 'closest .irbrc is executed by default' do
|
93
|
+
Dir.chdir(File.expand_path('../../../fixtures', __FILE__)) do
|
94
|
+
WebConsole::REPL::IRB.new.tap do
|
95
|
+
assert $IRBRC_EXECUTED
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
test 'closest .irbrc execution can be prevented' do
|
101
|
+
WebConsole::Engine.config.web_console.prevent_irbrc_execution = true
|
102
|
+
Dir.chdir(File.expand_path('../../../fixtures', __FILE__)) do
|
103
|
+
WebConsole::REPL::IRB.new.tap do
|
104
|
+
assert_not $IRBRC_EXECUTED
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
76
109
|
test 'rails helpers are available in the session' do
|
77
110
|
each_rails_console_method do |meth|
|
78
111
|
assert_equal return_prompt(true), @irb.send_input("respond_to? :#{meth}")
|
@@ -105,4 +138,22 @@ class IRBTest < ActiveSupport::TestCase
|
|
105
138
|
require 'rails/console/helpers'
|
106
139
|
Rails::ConsoleMethods.public_instance_methods.each(&block)
|
107
140
|
end
|
141
|
+
|
142
|
+
def new_uninitialized_app(root = File.expand_path('../../../dummy', __FILE__))
|
143
|
+
FileUtils.mkdir_p root
|
144
|
+
Dir.chdir root
|
145
|
+
|
146
|
+
old_app = Rails.application
|
147
|
+
Rails.application = nil
|
148
|
+
|
149
|
+
app = Class.new(Rails::Application)
|
150
|
+
app.config.eager_load = false
|
151
|
+
app.config.time_zone = 'UTC'
|
152
|
+
app.config.middleware ||= Rails::Configuration::MiddlewareStackProxy.new
|
153
|
+
app.config.active_support.deprecation = :notify
|
154
|
+
|
155
|
+
yield app
|
156
|
+
ensure
|
157
|
+
Rails.application = old_app
|
158
|
+
end
|
108
159
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web-console
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genadi Samokovarov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-08-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -105,7 +105,6 @@ files:
|
|
105
105
|
- test/dummy/bin/rails
|
106
106
|
- test/dummy/bin/rake
|
107
107
|
- test/dummy/bin/bundle
|
108
|
-
- test/dummy/tmp/pids/server.pid
|
109
108
|
- test/dummy/tmp/cache/assets/development/sprockets/b3159b06164dd474ff8efc3c84aefbba
|
110
109
|
- test/dummy/tmp/cache/assets/development/sprockets/f5deea0ae9671fdb035aefc6c4ba1109
|
111
110
|
- test/dummy/tmp/cache/assets/development/sprockets/508ab3c25833ea537a5e3fc90df33595
|
@@ -225,7 +224,6 @@ test_files:
|
|
225
224
|
- test/dummy/bin/rails
|
226
225
|
- test/dummy/bin/rake
|
227
226
|
- test/dummy/bin/bundle
|
228
|
-
- test/dummy/tmp/pids/server.pid
|
229
227
|
- test/dummy/tmp/cache/assets/development/sprockets/b3159b06164dd474ff8efc3c84aefbba
|
230
228
|
- test/dummy/tmp/cache/assets/development/sprockets/f5deea0ae9671fdb035aefc6c4ba1109
|
231
229
|
- test/dummy/tmp/cache/assets/development/sprockets/508ab3c25833ea537a5e3fc90df33595
|
@@ -1 +0,0 @@
|
|
1
|
-
19295
|