-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to add custom reloaders to run before running all specs. #43
base: master
Are you sure you want to change the base?
Conversation
Hi @sumitmah, thanks for this! Before we get this ready to merge, could you help us understand the scenario in which you want to have special reloaders associated with run_all but not normal runs? |
Gemfile.lock | ||
.idea/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather not see .idea
in the project .gitignore, as it's specific to your editor. Instead, this belongs in your global gitignore file. See https://help.github.com/articles/ignoring-files/ for setting this up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
@nilbus As it is mentioned in readme,
I was also facing similar issues with my Rails project. e.g. for shared specs(I saw similar issue already posted for this gem) "context not found". This was happening because of following code. def unload_previous_examples
::RSpec.configuration.reset
::RSpec.world.reset
end
def reset
example_groups.clear
@shared_example_group_registry = nil
end Here is example from my guardfile reload_shared_specs = lambda do
if Object.const_defined?('Rails')
$LOADED_FEATURES.reject! { |path| path =~ /\/spec\/support\//}
ActiveSupport::Dependencies.loaded.reject! { |path| path =~ /\/spec\/support\//}.inspect
ActiveSupport::Dependencies.autoloaded_constants.each {|c| ActiveSupport::Dependencies.loaded.reject! { |path| path =~ /#{c.to_s.underscore}/} }
ActiveSupport::Dependencies.autoloaded_constants.each {|c| $LOADED_FEATURES.reject! { |path| path =~ /#{c.to_s.underscore}/} }
ActiveSupport::Dependencies.explicitly_unloadable_constants.each {|c| ActiveSupport::Dependencies.loaded.reject! { |path| path =~ /#{c.to_s.underscore}/} }
ActiveSupport::Dependencies.explicitly_unloadable_constants.each {|c| $LOADED_FEATURES.reject! { |path| path =~ /#{c.to_s.underscore}/} }
Dir[::Rails.root.join('spec/support/**/*.rb')].each { |f| ::RSpec.world.shared_example_group_registry.require_or_load(f) }
end
end |
Thanks for the background information, and sorry for the delay @sumitmah. I'm trying to connect the code changes with that background story. Is the Guardfile code you provided what you're running inside a |
@nilbus Yes |
This ability will give us resolve issues related to missing constants, loading/requiring files.