make autotest integration better, and provide for default options using .jasmine-headless-webkit
This commit is contained in:
parent
e2efc83b3a
commit
829d2d2187
21
README.md
21
README.md
@ -19,14 +19,6 @@ serialize.
|
||||
|
||||
`gem install jasmine-headless-webkit` or use Bundler.
|
||||
|
||||
## Usage
|
||||
|
||||
jasmine-headless-webkit [options] [path to jasmine.yml, defaults to spec/javascripts/support/jasmine.yml]
|
||||
|
||||
Current supported options:
|
||||
|
||||
* `-c` enables color output
|
||||
|
||||
Installation requires Qt 4.7. See [senchalabs/examples](https://github.com/senchalabs/examples) and [my fork
|
||||
of examples](https://github.com/johnbintz/examples) for more information on the QtWebKit runner.
|
||||
|
||||
@ -35,12 +27,25 @@ Tested in the following environments:
|
||||
* Mac OS X 10.6, with MacPorts Qt and Nokia Qt.mpkg
|
||||
* Kubuntu 10.10
|
||||
|
||||
## Usage
|
||||
|
||||
jasmine-headless-webkit [options] [path to jasmine.yml, defaults to spec/javascripts/support/jasmine.yml]
|
||||
|
||||
Current supported options:
|
||||
|
||||
* `-c` enables color output
|
||||
|
||||
These options can also be placed into a `.jasmine-headless-webkit` file in your project root.
|
||||
|
||||
### Autotest Integration
|
||||
|
||||
`jasmine-headless-webkit` can integrate with Autotest. Your `jasmine.yml` file needs to be in the default
|
||||
path, and you have to be ready to use a very alpha implementation of the feature. If used with RSpec 2,
|
||||
Jasmine tests run after RSpec tests.
|
||||
|
||||
You need to create a `.jasmine-headless-webkit` file in your project root for this integration
|
||||
to work.
|
||||
|
||||
### Server Interaction
|
||||
|
||||
`jasmine-headless-webkit` works the same as if you create an HTML file, manually load the Jasmine library and
|
||||
|
@ -8,14 +8,22 @@ opts = GetoptLong.new(
|
||||
[ '--colors', '-c', GetoptLong::NO_ARGUMENT ]
|
||||
)
|
||||
|
||||
colors = false
|
||||
opts.each do |opt, arg|
|
||||
options = { :colors => false }
|
||||
|
||||
process_options = lambda { |*args|
|
||||
opt = args.shift
|
||||
case opt
|
||||
when '--colors'
|
||||
colors = true
|
||||
when '--colors', '-c'
|
||||
options[:colors] = true
|
||||
end
|
||||
}
|
||||
|
||||
if File.file?('.jasmine-headless-webkit')
|
||||
File.readlines('.jasmine-headless-webkit').collect { |line| line.strip.split(' ', 2) }.flatten(1).each(&process_options)
|
||||
end
|
||||
|
||||
opts.each(&process_options)
|
||||
|
||||
data = YAML.load_file(ARGV.shift || 'spec/javascripts/support/jasmine.yml')
|
||||
gem_dir = File.expand_path('../..', __FILE__)
|
||||
|
||||
@ -78,7 +86,7 @@ window.console = { log: function(data) { debug.log(JSON.stringify(data)); } };
|
||||
HTML
|
||||
|
||||
File.open(target = "specrunner.#{$$}.html", 'w') { |fh| fh.print output }
|
||||
system %{#{File.join(gem_dir, 'ext/jasmine-webkit-specrunner/jasmine-webkit-specrunner')} #{colors ? '-c' : ''} #{target}}
|
||||
system %{#{File.join(gem_dir, 'ext/jasmine-webkit-specrunner/jasmine-webkit-specrunner')} #{options[:colors] ? '-c' : ''} #{target}}
|
||||
status = $?.exitstatus
|
||||
FileUtils.rm_f target
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Autotest.add_discovery { 'jasmine' if File.file?('./spec/javascripts/support/jasmine.yml') }
|
||||
Autotest.add_discovery { 'jasmine' if File.file?('./.jasmine-headless-webkit') }
|
||||
|
@ -73,7 +73,7 @@ module JasmineMixin
|
||||
end
|
||||
|
||||
def make_jasmine_cmd
|
||||
"#{JASMINE_PROGRAM} -c"
|
||||
"#{JASMINE_PROGRAM}"
|
||||
end
|
||||
|
||||
def setup_jasmine_project_mappings
|
||||
|
Loading…
Reference in New Issue
Block a user