GithubHelp home page GithubHelp logo

sporkrb / spork Goto Github PK

View Code? Open in Web Editor NEW
1.4K 1.4K 188.0 1.9 MB

A DRb server for testing frameworks (RSpec / Cucumber currently) that forks before each run to ensure a clean testing state.

Home Page: spork.rubyforge.org

License: MIT License

Ruby 99.87% Shell 0.13%

spork's People

Contributors

aslakhellesoy avatar bcardarella avatar bmabey avatar cflipse avatar dblock avatar dchelimsky avatar duff avatar e2 avatar edendevelopment avatar franckverrot avatar garygreyling avatar jarmo avatar joliss avatar kimjoar avatar lstoldt avatar marcandre avatar mattwynne avatar mcmire avatar milhouse avatar msch avatar pk avatar rdp avatar sahilm avatar schneems avatar scudco avatar southgate avatar stepheneb avatar tenderlove avatar timcharper avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spork's Issues

RSpec 2 support

I'm currently trying to get RSpec 2 and Spork working together. RSpec 2 currently lacks support for DRb, so that must be sorted first, which I'm working on: http://github.com/rspec/rspec-core/issues/issue/2

However, the architecture of RSpec 2 has changed in a way that makes the current interface to RSpec inappropriate. (Extract below.)

def run_tests(argv, stderr, stdout)
  ::Spec::Runner::CommandLine.run(
    ::Spec::Runner::OptionParser.parse(
      argv,
      stderr,
      stdout
    )
  )
end

I could implement ::Spec::Runner::CommandLine etc as an adapter in RSpec 2, but that would be a kludge.

I noticed that the TestFramework hierarchy is OCP-conformant, but with two limitations: it's only conformant with respect to helper file detection, and you can't (AFAICT) get Spork to load TestFramework subclasses from other gems before it runs the detection code. (If the second situation was possible, I could implement the Spork::TestFramework::RSpec2 inside RSpec 2 itself without forking Spork.)

My plan is to extend open the hierarchy to allow detection based secondarily on helper file contents, as you can figure out which version of RSpec is in use based on require lines (require 'spec' vs require 'rspec/core').

I still need to figure out the most correct interface to expose in RSpec 2 for the new adapter to communicate with - so I'll possibly invalidate some of this discussion, but I though I'd put this up as a brain dump.

Let me know if you have any thoughts! Cheers - Ash

Waiting 8-10 seconds after spec_helper has finished

Back in Rails 2.1 days spork was blazing fast, but now at 2.3 after the initial spec_helper.rb load there is a waiting period of around 8-10 seconds, (environent.rb is not loaded again, I checked with some puts here and there).

The current loading looks something like this(found out with puts-ing everywhere...):
spec_helper:start -- prefork -- spec_helper:end -- 8-10seconds wait -- each_run -- each_run -- spec_helper:start -- spec_helper:end

Do you have any idea how I could find out where this time is spent ?

debugger() produces internal error from ruby-debug

INTERNAL ERROR!!! wrong argument type DRb::DRbObject (expected File)
/Library/Ruby/Gems/1.8/gems/ruby-debug-0.10.3/cli/ruby-debug/interface.rb:112:in readline' /Library/Ruby/Gems/1.8/gems/ruby-debug-0.10.3/cli/ruby-debug/interface.rb:112:inreadline'
/Library/Ruby/Gems/1.8/gems/ruby-debug-0.10.3/cli/ruby-debug/interface.rb:62:in read_command' /Library/Ruby/Gems/1.8/gems/ruby-debug-0.10.3/cli/ruby-debug/processor.rb:246:inprocess_commands'
/Library/Ruby/Gems/1.8/gems/ruby-debug-0.10.3/cli/ruby-debug/processor.rb:171:in __at_line' (eval):5:inat_line'
(eval):3:in synchronize' (eval):3:inat_line'
/Library/Ruby/Gems/1.8/gems/ruby-debug-base-0.10.3/lib/ruby-debug-base.rb:54:in at_line' ./spec/views/designs/new.html.haml_spec.rb:28 /Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/assertions/selector_assertions.rb:309:inassert_select'
[trimmed]

infinite loop using --drb in spec.opts and rspec 1.3.0

I'm currently playing with getting spork working for a merb app we're working on - I'm pretty sure i've managed to split up the bootloading process of merb into prefork and each_run.

However, i'm running into a problem that appears to be mostly unrelated to merb. Here's the flow as I follow it:

spork rspec (starts spork server)
autospec

  • this runs ruby spec file_list -O spec/spec.opts
  • as spec.opts contains --drb, the parse_options stuff in rspec bails out at parse_drb and runs the DrbCommandLine runner
  • The DRB Runner sends the run message to spork, which runs the test_framework run_tests method
  • run_tests for RSpec fires up the the normal CommandLine runner but the commandline runner saves the current options
  • the current options are loaded from Spec::Runner.options, which is a lazy loading attribute which fetches the options from ARGV
  • however if ARGV contains no switches, then the options are loaded in from spec.opts (which contains --drb)
  • hence the option parser sees the --drb flag and starts this whole process again!

I'm not quite sure why no-one else is running into this issue (or at least, no-one seems to be running into it and posting anything about it on the internet)

I'm probably going to work around the problem using a slightly messy hack for the moment, but I'm unsure what would be a good clean way to fix this.

Cucumber's encoding translation (CUCUMBER_OUTPUT_ENCODING) is probably broken

Hi,
first of all, I'm not sure, cause I use spork-Millhouse fork on windows. I use it with Cucumber. As windows console default encoding is 866 while I write Cucumber scenarios in UTF-8, to get proper text in console output I have to use encoding translation which is built-in Cucumber. I set up CUCUMBER_OUTPUT_ENCODING, and the translation perfectly works when Cucumber starts rails by its own, but when I tell it to use spork test server( --drb), then I get ugly texts printed out to console. It seems like built-in Cucumber encoding translation has been somehow switched off by spork.

Cause I have no linux, I can not check out whether that bug relates only to Millhouse's fork, or to yours one too.

Grate tool anyway! Thank you!

Rails caches views in test environment by default

And so changes you make in you views after spork is loaded are not hooked up.

config.action_view.cache_template_loading should be set to "false" in confing/environments/test.rb (and config/environments/cucumber.rb if you have that).

Maybe the instruction should be added to the README.

Support for Merb

Spork will work with Merb already, but doesn't quite have the "out of the box" experience that rails does (Spork automatically hooks in to Rails to make a lot of things just work by default, like preventing your ApplicationController, views, and models from being cached).

Rails doesn't recognize that frozen spork has been built

Rails determines whether or not a frozen gem (more specifically: it's extensions) has been built by checking for the existance of a Makefile in the extension's directory. Spork however doesn't create one and Rails thus always thinks the frozen gem hasn't been built yet.

I'd suggest to create a dummy Make- instead of Rakefile to remedy this.

platform-specific bundler Gemfile

I wanted to run the test on my rvm installed version of 1.9.2-head and needed to specify that under ruby_19 the gem ruby-debug19 should be installed instead of ruby-debug.

Bundler 1.0 supports specifying platform gem dependencies like this:

platforms :ruby_19 do
  gem 'ruby-debug19'
end
platforms :ruby_18 do
  gem 'ruby-debug'
end

See comments in this issue for a bit more info: http://github.com/carlhuda/bundler/issues/#issue/426

The 1.0 version is still prerelease so you need to install it like this:

gem install bundler --pre

Unfortunately ruby-debug19 needs to be passed a path to where the active ruby is:

gem install ruby-debug19 -- --with-ruby-include=/Users/stephen/.rvm/src/ruby-1.9.2-head/

See this comment: http://github.com/carlhuda/bundler/issues/#issue/23/comment/311834

When I installed ruby-debug19 manually the command 'bundle install' completed successfully.

Support for Micronaut

Vote if you'd like Spork to support Micronaut (and Micronaut to support running tests over drb)

Spork closes down when spec throw an exception

As the title says, each time spec command throws some kind of exception, spork will close down.

For example, trying to run something like:

spec non_existent_file.rb

throws the expected 'file not found' error, and in the spork window I get:

Spork is ready and listening on 8989! /var/lib/gems/1.8/gems/spork-0.7.5/bin/../lib/spork/forker.rb:42:in `load': end of file reached (EOFError) from /var/lib/gems/1.8/gems/spork-0.7.5/bin/../lib/spork/forker.rb:42:in`result' from /var/lib/gems/1.8/gems/spork-0.7.5/bin/../lib/spork/forker.rb:40:in `initialize' from /var/lib/gems/1.8/gems/spork-0.7.5/bin/../lib/spork/forker.rb:40:in`new' from /var/lib/gems/1.8/gems/spork-0.7.5/bin/../lib/spork/forker.rb:40:in `result' from /var/lib/gems/1.8/gems/spork-0.7.5/lib/spork/run_strategy/forking.rb:15:in`run' I'm using:

spork (0.7.5)
rspec (1.3.0)
rspec-rails (1.3.2)
rails (2.3.5)

spec_helper example

It'll be great to have an idea of what you put inside Spork.prefork and Spork.each_run blocks in your spec_helper.rb, can you give an example, please? Thanks!

App reloading rails-3.0.0/ruby1.9.2-p0/spork-0.9.0.rc2

Hello, I'm trying out spork (0.9.0.rc2) with a brand new rails (3.0.0) app. I'm unable to make spork to reload files/classes. Once spork is launched, controllers, models, routes or specs are no longer reloaded. I've read all related issues here and tried all possible workarounds but nothing seems to work. Can you please provide up to date information about the status of reloading?

Incompatible with role_requirement plugin

Spork traps EagerPath's load!, which is required to render a 401 page to test role_requirement's ability to lock out people. Has this happened to anyone else? For now I'll monkeypatch..

support for Test::Unit

Lots of people still use it. Vote for this if you'd like to see Test::Unit support for Spork.

Nested models and RSpec

Hello,

Spork is not reloading nested models which change.

For example

 app/models/customer.rb
 app/models/customer/subscriptions.rb

Both are loaded fine, but any changes to the files are not reflected. Is there work around? If not I can put together a sample demonstrating the issue.

My spec_helper.rb http://gist.github.com/286048

spork (0.7.5)
rspec (1.3.0)
rspec-rails (1.3.2)

Thanks - JW

Exception encountered: #<ActiveRecord::AdapterNotSpecified: test database is not configured>

Hi Tim, very happy to see the 0.9.0.rc gem!

I got this exception when running my spec (2.0.0.beta.22) with --drb (without spec running fine):

Exception encountered: #<ActiveRecord::AdapterNotSpecified: test database is not configured>
backtrace:
/Users/Thibaud/.rvm/gems/ree-1.8.7-2010.02/gems/activerecord-3.0.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:62:in `establish_connection'
/Users/Thibaud/.rvm/gems/ree-1.8.7-2010.02/gems/activerecord-3.0.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:55:in `establish_connection'
/Users/Thibaud/.rvm/gems/ree-1.8.7-2010.02/gems/spork-0.9.0.rc/lib/spork/app_framework/rails.rb:57:in `preload_rails'
/Users/Thibaud/.rvm/gems/ree-1.8.7-2010.02/gems/spork-0.9.0.rc/bin/../lib/spork.rb:74:in `call'
/Users/Thibaud/.rvm/gems/ree-1.8.7-2010.02/gems/spork-0.9.0.rc/bin/../lib/spork.rb:74:in `exec_each_run'
/Users/Thibaud/.rvm/gems/ree-1.8.7-2010.02/gems/spork-0.9.0.rc/bin/../lib/spork.rb:74:in `each'
/Users/Thibaud/.rvm/gems/ree-1.8.7-2010.02/gems/spork-0.9.0.rc/bin/../lib/spork.rb:74:in `exec_each_run'
/Users/Thibaud/.rvm/gems/ree-1.8.7-2010.02/gems/spork-0.9.0.rc/lib/spork/run_strategy/forking.rb:12:in `run'
/Users/Thibaud/.rvm/gems/ree-1.8.7-2010.02/gems/spork-0.9.0.rc/lib/spork/forker.rb:21:in `initialize'
/Users/Thibaud/.rvm/gems/ree-1.8.7-2010.02/gems/spork-0.9.0.rc/lib/spork/forker.rb:18:in `fork'
/Users/Thibaud/.rvm/gems/ree-1.8.7-2010.02/gems/spork-0.9.0.rc/lib/spork/forker.rb:18:in `initialize'
/Users/Thibaud/.rvm/gems/ree-1.8.7-2010.02/gems/spork-0.9.0.rc/lib/spork/run_strategy/forking.rb:9:in `new'
/Users/Thibaud/.rvm/gems/ree-1.8.7-2010.02/gems/spork-0.9.0.rc/lib/spork/run_strategy/forking.rb:9:in `run'
/Users/Thibaud/.rvm/gems/ree-1.8.7-2010.02/gems/spork-0.9.0.rc/lib/spork/server.rb:47:in `run'
/Users/Thibaud/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/drb/drb.rb:1558:in `__send__'
/Users/Thibaud/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/drb/drb.rb:1558:in `perform_without_block'
/Users/Thibaud/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/drb/drb.rb:1518:in `perform'
/Users/Thibaud/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/drb/drb.rb:1592:in `main_loop'
/Users/Thibaud/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/drb/drb.rb:1588:in `loop'
/Users/Thibaud/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/drb/drb.rb:1588:in `main_loop'
/Users/Thibaud/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/drb/drb.rb:1584:in `start'
/Users/Thibaud/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/drb/drb.rb:1584:in `main_loop'
/Users/Thibaud/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/drb/drb.rb:1433:in `run'
/Users/Thibaud/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/drb/drb.rb:1430:in `start'
/Users/Thibaud/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/drb/drb.rb:1430:in `run'
/Users/Thibaud/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/drb/drb.rb:1350:in `initialize'
/Users/Thibaud/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/drb/drb.rb:1630:in `new'
/Users/Thibaud/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/drb/drb.rb:1630:in `start_service'
/Users/Thibaud/.rvm/gems/ree-1.8.7-2010.02/gems/spork-0.9.0.rc/lib/spork/server.rb:29:in `listen'
/Users/Thibaud/.rvm/gems/ree-1.8.7-2010.02/gems/spork-0.9.0.rc/lib/spork/server.rb:20:in `run'
/Users/Thibaud/.rvm/gems/ree-1.8.7-2010.02/gems/spork-0.9.0.rc/bin/../lib/spork/runner.rb:76:in `run'
/Users/Thibaud/.rvm/gems/ree-1.8.7-2010.02/gems/spork-0.9.0.rc/bin/../lib/spork/runner.rb:10:in `run'
/Users/Thibaud/.rvm/gems/ree-1.8.7-2010.02/gems/spork-0.9.0.rc/bin/spork:10
/Users/Thibaud/.rvm/gems/ree-1.8.7-2010.02/bin/spork:19:in `load'
/Users/Thibaud/.rvm/gems/ree-1.8.7-2010.02/bin/spork:19

Here my spork --d:

Using RSpec
Preloading Rails environment
Loading Spork.prefork block...
- Spork Diagnosis -
-- Summary --
config/application.rb
config/boot.rb
spec/spec_helper.rb
-- Detail --
--- config/application.rb ---
--- config/boot.rb ---
--- spec/spec_helper.rb ---

Any ideas? Thanks!

Easy gem dependency installation

While doing some work on Spork I noticed that to run all the features (which I'm having trouble with - separate problem though) you have to install a lot of gems. Something like a rake task, or possibly a Bundler Gemfile would make it quicker to get up and running. This is also convenient if (like me) you use rvm, and occasionally bomb a gemset if general weirdness occurs.

Diagnoser steps on Bundler's toes

Found an issue today: Running spork --diagnose against an app that loads Bundler on boot (I'm using Padrino here but I imagine the same thing would happen under Rails 3) will die with "private method 'require' called for Bundler:Module". This is because when Spork::Diagnoser overrides Kernel#require, it doesn't mark the new method as private, so Bundler.require ends up getting overridden (or something). Backtrace below:

elliot@excalibur:~/code/github/mine/moolah$ ~/code/github/forks/spork/bin/spork --diagnose
Using RSpec
Loading Spork.prefork block...
Booting Padrino...
private method `require' called for Bundler:Module (NoMethodError)
/Users/elliot/code/github/mine/moolah/config/boot.rb:24
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require_without_diagnoser'
/Users/elliot/code/github/forks/spork/lib/spork/diagnoser.rb:31:in `require'
/Users/elliot/code/github/mine/moolah/spec/spec_helper.rb:19
/Users/elliot/code/github/forks/spork/bin/../lib/spork.rb:23:in `prefork'
/Users/elliot/code/github/mine/moolah/spec/spec_helper.rb:14
/Users/elliot/code/github/forks/spork/lib/spork/diagnoser.rb:36:in `load_without_diagnoser'
/Users/elliot/code/github/forks/spork/lib/spork/diagnoser.rb:36:in `load'
/Users/elliot/code/github/forks/spork/lib/spork/test_framework.rb:138:in `preload'
/Users/elliot/code/github/forks/spork/lib/spork/app_framework.rb:61:in `preload'
/Users/elliot/code/github/forks/spork/lib/spork/test_framework.rb:134:in `preload'
/Users/elliot/code/github/forks/spork/bin/../lib/spork.rb:67:in `exec_prefork'
/Users/elliot/code/github/forks/spork/lib/spork/test_framework.rb:120:in `preload'
/Users/elliot/code/github/forks/spork/lib/spork/runner.rb:68:in `run'
/Users/elliot/code/github/forks/spork/lib/spork/runner.rb:9:in `run'
/Users/elliot/code/github/forks/spork/bin/spork:10

I fixed it and made a topic branch here: http://github.com/mcmire/spork/tree/diagnoser_bundler_compatibility. Thanks!

[WORKAROUND] Spork won't run [no such file to load -- magazine_slave (LoadError)], ruby 1.9.2, gem 1.3.7, windows

I could not get Spork to run after a fresh install of Ruby 1.9.2 + gem 1.3.7 on Win7 x64.
The error message was:

Using RSpec
  -- Rinda Ring Server listening for connections...
  -- Starting to fill pool...
     Wait until at least one slave is provided before running tests...
  ** CTRL+BREAK to stop Spork and kill all ruby slave processes **
Spork is ready and listening on 8989!
:29:in `require': no such file to load -- magazine_slave (LoadError)
        from :29:in `require'
        from magazine_slave_provider.rb:5:in `'
:29:in `require': no such file to load -- magazine_slave (LoadError)
        from :29:in `require'
        from magazine_slave_provider.rb:5:in `'

Then found the following workaround:

In lib/spork/run_strategy/magazine/magazine_slave_provider.rb on line 5 change:

require 'magazine_slave'

to:

require './magazine_slave.rb'

I don't call it a patch because I don't think it is an issue related to Spork. It is more likely a rubygems problem. However I hope this workaround will help someone with the same problem.

Losing loaded blueprints after each step

Environment: Rails 3, Cucumber, Spork, Machinist

No blueprint for class Sponsor (RuntimeError)
./features/sponsors/step_definitions/index_steps.rb:2:in /^I have a sponsor$/' features/schools/outreach/email.feature:8:inAnd I have a sponsor'

blueprint.rb

Sponsor.blueprint do
end

This happens AFTER the first step in a Cucumber scenario has run. In other words, the first step runs fine with Sponsor.blueprint, but on the second, spork seems to have forgotten that Sponsor.blueprint was ever defined in blueprint.rb. I've attempted to "load()" it each time in the Spork.each_run block, but it makes no difference.

Any ideas? Thanks!!

Spork gem can't actually be installed

$ sudo gem install timcharper-spork --source http://gems.github.com
ERROR: could not find gem timcharper-spork locally or in a repository

http://hasmygembuiltyet.org/timcharper/spork

I was able to install it locally by cloning and then I found the culprit in the gemspec. Seems you can't use things like Dir['lib/*/.rb'] when running with the SAFE level at 3 like github does.

Here's my patch
http://github.com/scudco/spork/commit/c31c8ea83da1ca2acc3fc74bd59c91aeca2dcde4

spork --help == uninitialized constant Spork::Runner::StringIO (NameError)

When I run spork --help I get:
Usage: spork [test framework name] [options]

Options:
    -b, --bootstrap
    -d, --diagnose
    -h, --help
    -p, --port [PORT]

uninitialized constant Spork::Runner::StringIO (NameError)
/Users/andrew/.rvm/gems/ree-1.8.7-2010.02/gems/spork-0.8.4/bin/../lib/spork/runner.rb:38:in `supported_test_frameworks_text'
/Users/andrew/.rvm/gems/ree-1.8.7-2010.02/gems/spork-0.8.4/bin/../lib/spork/runner.rb:32:in `initialize'
/Users/andrew/.rvm/gems/ree-1.8.7-2010.02/gems/spork-0.8.4/bin/../lib/spork/runner.rb:9:in `new'
/Users/andrew/.rvm/gems/ree-1.8.7-2010.02/gems/spork-0.8.4/bin/../lib/spork/runner.rb:9:in `run'
/Users/andrew/.rvm/gems/ree-1.8.7-2010.02/gems/spork-0.8.4/bin/spork:10
/Users/andrew/.rvm/gems/ree-1.8.7-2010.02/bin/spork:19:in `load'
/Users/andrew/.rvm/gems/ree-1.8.7-2010.02/bin/spork:19

starting spork causes segfault on Windows under Ruby 1.9.1

System: Win XP Pro SP3
Ruby: ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32]
Gems:
rspec (1.3.0)
spork (0.8.1)
win32-api (1.4.6)
win32-process (0.6.2)

Trace below:

C:\Dev\apps\win\dde>spork
Using RSpec
C:/Dev/ruby/lib/ruby/gems/1.9.1/gems/win32-api-1.4.6-x86-mingw32/lib/win32/api.so: [BUG] Segmentation fault
ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32]

-- control frame ----------
c:0027 p:-5020060 s:0078 b:0078 l:000077 d:000077 TOP
c:0026 p:---- s:0076 b:0076 l:000075 d:000075 CFUNC :require
c:0025 p:0011 s:0072 b:0072 l:000071 d:000071 TOP C:/Dev/ruby/lib/ruby/gems/1.9.1/gems/windows-api-0.4.0/lib/windows/api.rb:1
c:0024 p:---- s:0070 b:0070 l:000069 d:000069 FINISH
c:0023 p:---- s:0068 b:0068 l:000067 d:000067 CFUNC :require
c:0022 p:0011 s:0064 b:0064 l:000063 d:000063 TOP C:/Dev/ruby/lib/ruby/gems/1.9.1/gems/windows-pr-1.0.9/lib/windows/error.rb:12
c:0021 p:---- s:0062 b:0062 l:000061 d:000061 FINISH
c:0020 p:---- s:0060 b:0060 l:000059 d:000059 CFUNC :require
c:0019 p:0011 s:0056 b:0056 l:000055 d:000055 TOP C:/Dev/ruby/lib/ruby/gems/1.9.1/gems/win32-process-0.6.2/lib/win32/process.rb:1
c:0018 p:---- s:0054 b:0054 l:000053 d:000053 FINISH
c:0017 p:---- s:0052 b:0052 l:000051 d:000051 CFUNC :require
c:0016 p:0047 s:0048 b:0048 l:000047 d:000047 TOP C:/Dev/ruby/lib/ruby/gems/1.9.1/gems/spork-0.8.1/lib/spork/run_strategy/magazine.rb:6
c:0015 p:---- s:0046 b:0046 l:000045 d:000045 FINISH
c:0014 p:---- s:0044 b:0044 l:000043 d:000043 CFUNC :require
c:0013 p:0012 s:0040 b:0040 l:000031 d:000039 BLOCK C:/Dev/ruby/lib/ruby/gems/1.9.1/gems/spork-0.8.1/lib/spork/run_strategy.rb:44
c:0012 p:---- s:0037 b:0037 l:000036 d:000036 FINISH
c:0011 p:---- s:0035 b:0035 l:000034 d:000034 CFUNC :each
c:0010 p:0049 s:0032 b:0032 l:000031 d:000031 TOP C:/Dev/ruby/lib/ruby/gems/1.9.1/gems/spork-0.8.1/lib/spork/run_strategy.rb:44
c:0009 p:---- s:0030 b:0030 l:000029 d:000029 FINISH
c:0008 p:0133 s:0028 b:0028 l:000027 d:000027 METHOD C:/Dev/ruby/lib/ruby/gems/1.9.1/gems/spork-0.8.1/lib/spork/runner.rb:73
c:0007 p:0023 s:0023 b:0023 l:000022 d:000022 METHOD C:/Dev/ruby/lib/ruby/gems/1.9.1/gems/spork-0.8.1/lib/spork/runner.rb:9
c:0006 p:0133 s:0017 b:0017 l:000016 d:000016 TOP C:/Dev/ruby/lib/ruby/gems/1.9.1/gems/spork-0.8.1/bin/spork:10
c:0005 p:---- s:0013 b:0013 l:000012 d:000012 FINISH
c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :load
c:0003 p:0127 s:0007 b:0007 l:001044 d:001ed8 EVAL C:/Dev/ruby/bin/spork:19
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH

c:0001 p:0000 s:0002 b:0002 l:001044 d:001044 TOP

-- Ruby level backtrace information-----------------------------------------
C:/Dev/ruby/lib/ruby/gems/1.9.1/gems/windows-api-0.4.0/lib/windows/api.rb:1:in require' C:/Dev/ruby/lib/ruby/gems/1.9.1/gems/windows-api-0.4.0/lib/windows/api.rb:1:in<top (required)>'
C:/Dev/ruby/lib/ruby/gems/1.9.1/gems/windows-pr-1.0.9/lib/windows/error.rb:12:in require' C:/Dev/ruby/lib/ruby/gems/1.9.1/gems/windows-pr-1.0.9/lib/windows/error.rb:12:in<top (required)>'
C:/Dev/ruby/lib/ruby/gems/1.9.1/gems/win32-process-0.6.2/lib/win32/process.rb:1:in require' C:/Dev/ruby/lib/ruby/gems/1.9.1/gems/win32-process-0.6.2/lib/win32/process.rb:1:in<top (required)>'
C:/Dev/ruby/lib/ruby/gems/1.9.1/gems/spork-0.8.1/lib/spork/run_strategy/magazine.rb:6:in require' C:/Dev/ruby/lib/ruby/gems/1.9.1/gems/spork-0.8.1/lib/spork/run_strategy/magazine.rb:6:in<top (required)>'
C:/Dev/ruby/lib/ruby/gems/1.9.1/gems/spork-0.8.1/lib/spork/run_strategy.rb:44:in require' C:/Dev/ruby/lib/ruby/gems/1.9.1/gems/spork-0.8.1/lib/spork/run_strategy.rb:44:inblock in <top (required)>'
C:/Dev/ruby/lib/ruby/gems/1.9.1/gems/spork-0.8.1/lib/spork/run_strategy.rb:44:in each' C:/Dev/ruby/lib/ruby/gems/1.9.1/gems/spork-0.8.1/lib/spork/run_strategy.rb:44:in<top (required)>'
C:/Dev/ruby/lib/ruby/gems/1.9.1/gems/spork-0.8.1/lib/spork/runner.rb:73:in run' C:/Dev/ruby/lib/ruby/gems/1.9.1/gems/spork-0.8.1/lib/spork/runner.rb:9:inrun'
C:/Dev/ruby/lib/ruby/gems/1.9.1/gems/spork-0.8.1/bin/spork:10:in <top (required)>' C:/Dev/ruby/bin/spork:19:inload'
C:/Dev/ruby/bin/spork:19:in `

'

[NOTE]
You may encounter a bug of Ruby interpreter. Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

warning: already initialized constant SUPPORTED_FRAMEWORKS

after upgrading from 0.7.3 to 0.7.4, I now get the following warning when I start up the spork server:
/Library/Ruby/Gems/1.8/gems/spork-0.7.4/bin/../lib/spork/app_framework.rb:8: warning: already initialized constant SUPPORTED_FRAMEWORKS

Doesn't seem to affect anything though.

spork + rspec-2 + rails-3 doesn't reload models by default

I just got rspec-2 working with spork and rails-3. I haven't had a chance to investigate why yet, but with this configuration we need to set config.cache_classes = false to get models to reload. This suggests that rails is eager loading models during the prefork (which in my case is not asking to load anything under app). Something we can manage from spork?

trap_method (and trap_class_method) not sending blocks

Imagine, I've got to trap Spec::Runner's .configure method. It takes a block whose execution I need to delay. But as of now, spork (I've got 0.8.1) doesn't resend blocks.

As far as I can see, it's not that hard to implement block resending, I could even do it myself if needed, although I'm not that familiar with spork internals to say it'll go without consequences.

Misspelling in spork

If you run spork in a project where it has not been bootstrapped yet:

I can't do anything for you by default for the framework your using: Unknown.
You must bootstrap ~/Dropbox/SeniorProject/SPScaffold/spec/spec_helper.rb to continue.

Should be

I can't do anything for you by default for the framework you're using: Unknown.
You must bootstrap ~/Dropbox/SeniorProject/SPScaffold/spec/spec_helper.rb to continue.

Custom helper aren't found when running spork

If I use a custom helper method in a view spork generates an error because this helper method is unknown. If the method is in a controller helper (app/helpers/items_helper.rb in my example) everything is okay.

I put an example on github: http://github.com/JerryWho/test
If rake spec is run without spork all tests pass. But with spork an error occurs:

ActionView::TemplateError in '/items/index.html.erb renders a list of items'
undefined method `simpleFunction' for #ActionView::Base:0x243ca54

In tmp/rails-debug.log I write the loaded files. app/helpers/simple_helper.rb appears. app/helpers/items_helper.rb also appears.

Application Controller not loading for Windows

I'm actually using the milhouse-spork gem, but it looks like that's been merge back in with the main branch so I'll post this here.

When running my specs with spork, my ApplicationController wasn't being loaded properly. After digging around expanded_caller in lib/spork.rb wasn't parsing caller line's properly because on Windows, the line include the disk name where the file lives (i.e. C:/foo/bar.rb:13:something else...) and it looks like the code assumes only the colons around the line number.

As a quick fix I just changed the split to split on a different regex. I only have a windows machine to test on, but I think this should keep *nix machines happy too.

And here's a diff: http://gist.github.com/325480

Don't preload ApplicationController

ApplicationController is preloaded by spork by this file:

http://gist.github.com/165271

Unfortunately, my ApplicationController doesn't descend directly from ActionController::Base

http://gist.github.com/165273
http://gist.github.com/165274

This is causing a superclass mismatch when I load spork + try to run specs:

http://gist.github.com/39871732f9a02cf84bcc.

I'm not sure what the idea fix here is - Do we remove the stub (and cause ApplicationController to be loaded automatically in the prefork block), or do we parse application.rb, and load up any other descendent classes?

A middle ground might be this: if your application descends directly from ActionController::Base, preload the stub, otherwise, load the real file.

Tell spork to reload

It would be very helpful if you could programmatically tell spork to reload. My use case is within autotest. When certain files change the entire environment needs to be reloaded. I'd like to be able to tell spork to reload from within my autotest mapping hooks. This could be done by sending a signal to the spork process or maybe connecting to the DRB server.

breaks when used with test_notifer

There is a wonderful gem call test_notifer (http://github.com/fnando/
test_notifier) that gives you desktop notifications of the results
when your tests complete (so you don't have to look at the
terminal).

Unfortunately, spork and test_notifer don't seem to play nice together
when running rspec (I haven't tried it with other frameworks). If you
require test_notifer/rspec in spec helper everything works great when
spork isn't running but if you try to run spork you get the follow
errors:

undefined method map' for nil:NilClass (NoMethodError) /usr/local/lib/site_ruby/1.8/rubygems.rb:270:inactivate'
/usr/local/lib/site_ruby/1.8/rubygems.rb:296:in activate' /usr/local/lib/site_ruby/1.8/rubygems.rb:295:ineach'
/usr/local/lib/site_ruby/1.8/rubygems.rb:295:in activate' /usr/local/lib/site_ruby/1.8/rubygems.rb:296:inactivate'
/usr/local/lib/site_ruby/1.8/rubygems.rb:295:in each' /usr/local/lib/site_ruby/1.8/rubygems.rb:295:inactivate'
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:35:in
require' /path_to_rails_app/spec/spec_helper.rb:4 /usr/lib/ruby/gems/1.8/gems/spork-0.7.5/lib/spork/test_framework.rb: 138:inload'
/usr/lib/ruby/gems/1.8/gems/spork-0.7.5/lib/spork/test_framework.rb:
138:in preload' /usr/lib/ruby/gems/1.8/gems/spork-0.7.5/lib/spork/app_framework/ rails.rb:121:inpreload'
/usr/lib/ruby/gems/1.8/gems/spork-0.7.5/lib/spork/test_framework.rb:
134:in preload' /usr/lib/ruby/gems/1.8/gems/spork-0.7.5/bin/../lib/spork.rb:57:in exec_prefork'
/usr/lib/ruby/gems/1.8/gems/spork-0.7.5/lib/spork/test_framework.rb:
120:in preload' /usr/lib/ruby/gems/1.8/gems/spork-0.7.5/lib/spork/run_strategy/ forking.rb:23:inpreload'
/usr/lib/ruby/gems/1.8/gems/spork-0.7.5/bin/../lib/spork/runner.rb:
74:in run' /usr/lib/ruby/gems/1.8/gems/spork-0.7.5/bin/../lib/spork/runner.rb: 9:inrun'
/usr/lib/ruby/gems/1.8/gems/spork-0.7.5/bin/spork:10
/usr/bin/spork:19:in `load'
/usr/bin/spork:19

Extend RSpec Feature

One of the things I've found very confusing as I've begun to use Spork is knowing where to put my Spec::Runner code. It'd be nice if the feature file for RSpec showed a more complete example file. As it stands things are pretty skimpy.

problems using haml with spork

does anyone out there use haml with spork?
we recently converted our project to use haml and now when we run tests with spork, every test fails with something like the following:

ActionView::TemplateError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.<<
On line #67 of app/views/layouts/application.html.haml

    64:   
    65:     #search_wrap{:class => %Q!#{controller.controller_name}_#{controller.action_name}!}
    66:       .container
    67:         - form_tag({:controller => 'products', :action => 'search', :protocol => 'http://', :only_path => false}, {:method => 'get', :id => 'sform'}) do
    68:           %h2
    69:             %label{:for => 'search_field', :title => 'Find'} Find:

It seems that anywhere we use form_tag in our views we get that error, doesn't seem to matter what is in form_tag either. It will throw the error with no parameters as well.

Any help would be appreciated.

Thanks!
Chris

Nested models and RSpec

Hello,

Spork is not reloading nested models which change.

For example

app/models/customer.rb
app/models/customer/subscriptions.rb

Both are loaded fine, but any changes to the files are not reflected. Is there work around? If not I can put together a sample demonstrating the issue.

My spec_helper.rb http://gist.github.com/286048

spork (0.7.5)
rspec (1.3.0)
rspec-rails (1.3.2)

Thanks - JW

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.