Skip to content
This repository has been archived by the owner on Jan 16, 2022. It is now read-only.

Change folders structure in a non-rails project #128

Closed
delphaber opened this issue Jan 18, 2013 · 4 comments
Closed

Change folders structure in a non-rails project #128

delphaber opened this issue Jan 18, 2013 · 4 comments

Comments

@delphaber
Copy link

Hi

I cannot understand how to change jasmine-gem default folders structure. For example: "public/javascripts" should be "js" and "spec" should be "protected/tests"

I've tried with

Jasmine.configure do |config|
  config.spec_dir = "protected/tests"  #for instance
end

but it didn't work. Thanks :)

@ragaskar
Copy link
Contributor

If you're using jasmine.yml you almost always will want to set this in jasmine.yml, as it reads this config right before starting up. If you're using HEAD you have the opportunity to override this (using jasmine_helper.rb) in a Jasmine.configure block, but otherwise jasmine.yml takes precedence

@delphaber
Copy link
Author

Thanks for the reply. I see... but maybe I'm missing something. I can override jasmine.yml options in spec/javascripts/support/jasmine_helper.rb . But I have not a spec/javascripts/support folder because my folder structure is different and I'd like to keep al my tests in a folder which is not "spec"

I hope I explained it well :)

@ragaskar
Copy link
Contributor

Ah, I understand. That may be trickier, I think right now you'll have to override the Rakefile and the run_specs.rb file.

Jasmine.load_configuration_from_yaml takes an optional path, which you'll want to set in your Rakefile, eg.

task :server => "jasmine:require" do
   port = ENV['JASMINE_PORT'] || 8888
   puts "your tests are here:"
   puts "  http://localhost:#{port}/"
  Jasmine.load_configuration_from_yaml("FULL_PATH_TO_MY_NEW_YAML")
  app = Jasmine::Application.app(Jasmine.config)
  Jasmine::Server.new(port, app).start
end

You'll also need to override Jasmine.runner_filepath with a new filepath that returns a custom run_specs.rb where you have also called load_configuration_from_yaml with the full path to your yml.

I'm not sure of an easier way to do this. Maybe we could allow you to configure the yaml location in Jasmine.configure and then you could just override that in your Rakefile?

@delphaber
Copy link
Author

Hi, thank you very much. I'm gonna try your solution within some days!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants