jejacks0n / teaspoon

Teaspoon: Javascript test runner for Rails. Use Selenium, BrowserStack, or PhantomJS.
1.43k stars 243 forks source link

Framework API #321

Closed jejacks0n closed 9 years ago

jejacks0n commented 9 years ago

This extracts the various javascript frameworks into sub-gems, which will eventually be released on their own, with a dependency on teaspoon (aka teaspoon-core).

This creates better separation, reduces complexity of the core library, and enables future frameworks to be more easily integrated. There is a similar concept that will happen on the client end as well.

It adds a framework concept with a simple DSL, and a way to register a framework with teaspoon. Frameworks can adjust installation steps, specify which versions of the javascript framework are available, and provide their own support libraries.

class FooFramework < Teaspoon::Framework
  framework_name :jasmine
  register_version "1.3.1", "jasmine/1.3.1", "teaspoon-jasmine"
  add_asset_path File.expand_path("../teaspoon/jasmine/assets", __FILE__)

  # installation
  add_template_path File.expand_path("../teaspoon/jasmine/templates", __FILE__)
  install_to "spec" do
    ext = options[:coffee] ? ".coffee" : ".js"
    copy_file "spec_helper#{ext}", "spec/javascripts/spec_helper#{ext}"
  end
end
Teaspoon.register_framework(FooFramework)

Phase 2:

mikepack commented 9 years ago

:+1:

jejacks0n commented 9 years ago

@mikepack I'm going to merge this and start structuring the client code.. do you want me to merge the Jasmine2 stuff first, or is that not ready yet? My next steps will probably create several conflicts with your stuff.

mikepack commented 9 years ago

@jejacks0n feel free to merge this. I'm going to spend some time today on getting j2 merged.