我正在试图找出如何让RubyMine的控制台向咆哮发送消息.具体来说,因为我通过RubyMine运行Rspec&Spork,所以我想获得有关通过和失败的测试数量的Growl通知.
我通过Autotest和RedGreen宝石使用了这个功能的命令行版本,但是这两个宝石似乎都没有在RubyMine中保留其实用性.
有没有人成功推送过RubyMine的Growl通知?
任何人都可以想到可以启用通知的任何工具或机制吗?
我跟着spork railscast视频,当我试图守卫时,它给了我以下错误:
Guard is now watching at '/Users/m/work/'
Starting Spork for Test::Unit & RSpec
Couldn't find a supported test framework that begins with 'testunit'
Supported test frameworks:
( ) Cucumber
(*) RSpec
Legend: ( ) - not detected in project (*) - detected
Using RSpec
Preloading Rails environment
Loading Spork.prefork block...
Spork is ready and listening on 8989!
--> ERROR: Could not start Spork server for Test::Unit & RSpec. Make sure you can use it manually first.
Guard::RSpec …Run Code Online (Sandbox Code Playgroud) 我正在使用RSpec进行测试,当我周五下午离开工作时,我的测试正在通过.但当我回家并同步我的存储库时,我的笔记本电脑上的测试失败了.现在回到工作岗位,测试仍然失败.不要相信它的代码,因为运行rspec本身会返回一个错误,spork甚至不会启动.当我尝试启动Spork时,收到以下错误消息:
Using RSpec
Loading Spork.prefork block...
uninitialized constant ActionView::Template::Handlers::ERB::ENCODING_FLAG (NameError)
/home/jeff/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/rspec-core-2.2.1/lib/rspec/core/backward_compatibility.rb:20:in `const_missing'
/home/jeff/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_view/template/handlers/erb.rb:85:in `<class:ERB>'
/home/jeff/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_view/template/handlers/erb.rb:70:in `<module:Handlers>'
/home/jeff/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_view/template/handlers/erb.rb:28:in `<class:Template>'
/home/jeff/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_view/template/handlers/erb.rb:27:in `<module:ActionView>'
/home/jeff/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_view/template/handlers/erb.rb:6:in `<top (required)>'
/home/jeff/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_view/template/handlers.rb:10:in `extended'
/home/jeff/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_view/template.rb:99:in `extend'
/home/jeff/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_view/template.rb:99:in `<class:Template>'
/home/jeff/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_view/template.rb:8:in `<module:ActionView>'
/home/jeff/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_view/template.rb:6:in `<top (required)>'
<internal:lib/rubygems/custom_require>:29:in `require'
<internal:lib/rubygems/custom_require>:29:in `require'
/home/jeff/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_view/template/resolver.rb:3:in `<top (required)>'
<internal:lib/rubygems/custom_require>:29:in `require'
<internal:lib/rubygems/custom_require>:29:in `require'
/home/jeff/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_view/testing/resolvers.rb:1:in `<top (required)>'
<internal:lib/rubygems/custom_require>:29:in `require'
<internal:lib/rubygems/custom_require>:29:in `require'
/home/jeff/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/rspec-rails-2.2.1/lib/rspec/rails/view_rendering.rb:1:in `<top (required)>'
<internal:lib/rubygems/custom_require>:29:in `require'
<internal:lib/rubygems/custom_require>:29:in `require'
/home/jeff/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/rspec-rails-2.2.1/lib/rspec/rails.rb:9:in `<top (required)>'
<internal:lib/rubygems/custom_require>:33:in `require'
<internal:lib/rubygems/custom_require>:33:in `rescue in require'
<internal:lib/rubygems/custom_require>:29:in `require'
/home/jeff/Projects/Rails/vahsfbhistory/spec/spec_helper.rb:10:in `block in <top (required)>'
/home/jeff/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/spork-0.8.4/lib/spork.rb:23:in `prefork'
/home/jeff/Projects/Rails/vahsfbhistory/spec/spec_helper.rb:5:in `<top (required)>' …Run Code Online (Sandbox Code Playgroud) 我一直在使用Michael Hartl的Rails Tutorial来获取Ruby on Rails,并且最近一直在使用本教程的新Rails 4.0版本.我遇到了Spork的问题; 我知道我们正在使用Spork for Rails 4.0兼容性的自定义分支,这可能只是一个不同的不兼容性,但我想发布我的问题,看看我是做错了什么或者是否有任何想法.每当我在Spork运行时调用RSpec我得到一个ActiveRecord异常,而如果我自己调用RSpec我的测试成功运行 - 下面是一个示例终端转储:
oren@VM:~/ruby_projects/test_app$ rspec
Exception encountered: #<ActiveRecord::ConnectionNotEstablished: ActiveRecord::ConnectionNotEstablished>
backtrace:
/home/oren/.rvm/gems/ruby-2.0.0-p195@rails_4_0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:546:in `retrieve_connection'
/home/oren/.rvm/gems/ruby-2.0.0-p195@rails_4_0/gems/activerecord-4.0.0/lib/active_record/connection_handling.rb:79:in `retrieve_connection'
/home/oren/.rvm/gems/ruby-2.0.0-p195@rails_4_0/gems/activerecord-4.0.0/lib/active_record/connection_handling.rb:53:in `connection'
/home/oren/.rvm/gems/ruby-2.0.0-p195@rails_4_0/gems/activerecord-4.0.0/lib/active_record/migration.rb:792:in `current_version'
/home/oren/.rvm/gems/ruby-2.0.0-p195@rails_4_0/gems/activerecord-4.0.0/lib/active_record/migration.rb:800:in `needs_migration?'
/home/oren/.rvm/gems/ruby-2.0.0-p195@rails_4_0/gems/activerecord-4.0.0/lib/active_record/migration.rb:379:in `check_pending!'
/home/oren/ruby_projects/test_app/spec/spec_helper.rb:105:in `<top (required)>'
/home/oren/.rvm/gems/ruby-2.0.0-p195@rails_4_0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
/home/oren/.rvm/gems/ruby-2.0.0-p195@rails_4_0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `block in load'
/home/oren/.rvm/gems/ruby-2.0.0-p195@rails_4_0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
/home/oren/.rvm/gems/ruby-2.0.0-p195@rails_4_0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
/home/oren/.rvm/gems/ruby-2.0.0-p195@rails_4_0/gems/spork-1.0.0rc3/lib/spork/run_strategy/forking.rb:11:in `block in run'
/home/oren/.rvm/gems/ruby-2.0.0-p195@rails_4_0/gems/spork-1.0.0rc3/lib/spork/forker.rb:21:in `block in initialize'
/home/oren/.rvm/gems/ruby-2.0.0-p195@rails_4_0/gems/spork-1.0.0rc3/lib/spork/forker.rb:18:in `fork'
/home/oren/.rvm/gems/ruby-2.0.0-p195@rails_4_0/gems/spork-1.0.0rc3/lib/spork/forker.rb:18:in `initialize'
/home/oren/.rvm/gems/ruby-2.0.0-p195@rails_4_0/gems/spork-1.0.0rc3/lib/spork/run_strategy/forking.rb:9:in `new'
/home/oren/.rvm/gems/ruby-2.0.0-p195@rails_4_0/gems/spork-1.0.0rc3/lib/spork/run_strategy/forking.rb:9:in `run'
/home/oren/.rvm/gems/ruby-2.0.0-p195@rails_4_0/gems/spork-1.0.0rc3/lib/spork/server.rb:48:in `run'
/home/oren/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/drb/drb.rb:1588:in `perform_without_block'
/home/oren/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/drb/drb.rb:1548:in `perform'
/home/oren/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/drb/drb.rb:1626:in `block (2 levels) in main_loop'
/home/oren/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/drb/drb.rb:1622:in `loop'
/home/oren/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/drb/drb.rb:1622:in `block in main_loop' …Run Code Online (Sandbox Code Playgroud) 我使用spork 0.9.2和rspec 3.0.0.在尝试运行测试时,rspec --drb我有一个例外
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/spork-0.9.2/lib/spork/test_framework/rspec.rb:11:in run_tests: uninitialized constant RSpec::Core::CommandLine (NameError)
但是当将rspec版本改回2.6时 - 一切都还可以.有没有人遇到同样的问题?可以解决吗?
我整天都在使用spork,大部分时间它都非常棒.
但是,我经常遇到一些问题,我需要重新启动Spork以便我的测试通过......现在我想知道它是否比它的价值更麻烦.我是ruby的新手,所以有时我无法预测错误是由于刷新问题,还是因为我不熟悉Ruby和Rails而导致错误.
我需要将什么内容放入Spork.each_run块中,以便我的验证和其他内容被刷新,这样我就不必重新启动spork服务器了?
谢谢
这是问题所在.添加Guard gem时,我打电话时一切都很好Guard.当我添加时Spork,我得到以下错误,这不会影响测试我的测试,但每次我尝试重新启动Guard时它都会启动它.
19:01:28 - INFO - Guard uses TerminalTitle to send notifications.
19:01:28 - INFO - Starting Spork for RSpec
19:01:28 - ERROR - Guard::Spork failed to achieve its <start>, exception was:
Run Code Online (Sandbox Code Playgroud)
[#5232DAD6505A] ChildProcess :: LaunchError:没有这样的文件或目录 - bundle exec spork -p 8989 [#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/childprocess-0.3.7 /lib/childprocess/unix/fork_exec_process.rb:54:in
launch_process' [#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/childprocess-0.3.7/lib/childprocess/abstract_process.rb:68:instart'[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-spork-1.2.0/lib/后卫/叉勺/ spork_instance.rb:38:在start' [#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-spork-1.2.0/lib/guard/spork/runner.rb:33:in每个" [#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-spork-1.2.0/lib/guard/spork /runner.rb:33:inlaunch_sporks' [#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-spork-1.2.0/lib/guard/spork.rb:21:in启动" [#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-1.6.2/lib/guard/runner.rb:99:在block in run_supervised_task' [#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-1.6.2/lib/guard/runner.rb:97:in抓" [#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-1.6.2/lib/guard/runner.rb:97:inrun_supervised_task' [#5232DAD6505A] …
当我运行rspec spec/models结果是好的.
但是当我使用spork时,每个测试应该在哪里进行宏(如it { should validate_presence_of(:title) }使用FAILS,如下所示:undefined method 'validate_presence_of' for ...
我用:
rails (3.0.0)
shoulda (2.11.3)
spork (0.8.4)
rspec-rails (>= 2.0.0.beta.22)
Run Code Online (Sandbox Code Playgroud)
投机/ spec_helper.rb:
require 'rubygems'
require 'spork'
Spork.prefork do
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'shoulda'
...
现在Spring内置了rails 4.1,我很好奇为什么开发团队选择了Spring而不是其他人(Zeus和Spork).
他们为什么选择春天?
我有Spork测试服务器的问题.
如果我在config/environments/test.rb中设置config.cache_classes = false,那么规范就会开始出现rasie错误.
Failure/Error: task = Factory(:something, :foo => @foo, :bar => @bar)
DataMapper::ImmutableError:
Immutable resource cannot be modified
Run Code Online (Sandbox Code Playgroud)
这是我的spec_helper.rb:
require 'spork'
Spork.prefork do
if ENV['CODE_COVERAGE'] == '1'
require 'simplecov'
SimpleCov.start 'rails'
end
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'webmock/rspec'
require 'factory_girl'
Dir[Rails.root.join("spec/controllers/shared/*.rb")].each { |f| require f }
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
RSpec.configure do |config|
config.mock_with :mocha
config.include Rails.application.routes.url_helpers
config.include UrlHelper
config.before(:each) do
repository(:default) do
transaction = DataMapper::Transaction.new(repository)
transaction.begin
repository.adapter.push_transaction(transaction)
end
end
config.after(:each) do …Run Code Online (Sandbox Code Playgroud) spork ×10
rspec ×7
guard ×2
ruby ×2
datamapper ×1
factory-bot ×1
growl ×1
rspec-rails ×1
rubymine ×1
shoulda ×1
spring-gem ×1
validation ×1
zeus ×1