guard-jruby-rspec icon indicating copy to clipboard operation
guard-jruby-rspec copied to clipboard

can't reload the class

Open liguang2080 opened this issue 13 years ago • 4 comments
trafficstars

hi i have changed config.cache_classes = false but when i change someting in my source code , the guard can't reload the class

thank you

liguang2080 avatar Jun 06 '12 04:06 liguang2080

I'm having the same problem. When I change my specs they get reloaded, but when I change code, such as a class in ./lib I have to ctrl-c and restart guard, which, as we all know, takes fooooooorrreeeevvveeerrrrrrrr.

Guardfile:

interactor :simple
guard 'jruby-rspec', :cli => ["--tty", "--color"], :all_on_start => true, :all_after_pass => false do
  # Rails example
  watch(%r{^spec/.+_spec\.rb$})
  watch(%r{^app/(.+)\.rb$})                           { |m| "spec/#{m[1]}_spec.rb" }
  watch(%r{^app/(.*)(\.erb|\.haml)$})                 { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
  watch(%r{^lib/(.+)\.rb$})                           { |m| "spec/lib/#{m[1]}_spec.rb" }
  watch(%r{^app/controllers/(.+)_(controller)\.rb$})  { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
  watch(%r{^spec/support/(.+)\.rb$})                  { "spec" }
  watch('spec/spec_helper.rb')                        { "spec" }
  watch('config/routes.rb')                           { "spec/routing" }
  watch('app/controllers/application_controller.rb')  { "spec/controllers" }
  # Capybara request specs
  watch(%r{^app/views/(.+)/.*\.(erb|haml)$})          { |m| "spec/requests/#{m[1]}_spec.rb" }
end

spec_helper.rb


# 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 'rspec/autorun'

# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}

RSpec.configure do |config|
  # ## Mock Framework
  #
  # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
  #
  # config.mock_with :mocha
  # config.mock_with :flexmock
  # config.mock_with :rr

  # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
  config.fixture_path = "#{::Rails.root}/spec/fixtures"

  # If you're not using ActiveRecord, or you'd prefer not to run each of your
  # examples within a transaction, remove the following line or assign false
  # instead of true.
  config.use_transactional_fixtures = true

  # If true, the base class of anonymous controllers will be inferred
  # automatically. This will be the default behavior in future versions of
  # rspec-rails.
  config.infer_base_class_for_anonymous_controllers = false

  # Run specs in random order to surface order dependencies. If you find an
  # order dependency and want to debug it, you can fix the order by providing
  # the seed, which is printed after each run.
  #     --seed 1234
  config.order = "random"
end

wdelhagen avatar Aug 12 '12 01:08 wdelhagen

I'm having the same problem using jruby 1.6.8, guard-rspec 2.1.1) and guard-jruby-rspec 0.1.4

imella avatar Nov 09 '12 20:11 imella

can you guys confirm that this is fixed? thanks.

jkutner avatar Nov 11 '12 22:11 jkutner

Now it's working! Whenever I save a model for example, that particular test runs.

But it seems that it's not picking up the changes and I have config.cache_classes = false in my test environment.

imella avatar Nov 12 '12 13:11 imella