This repository has been archived by the owner on Jun 23, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ | |
# Ignore all logfiles and tempfiles. | ||
/log/*.log | ||
/tmp | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
namespace :karma do | ||
task :start => :environment do | ||
with_tmp_config :start | ||
end | ||
|
||
task :run => :environment do | ||
with_tmp_config :start, "--single-run" | ||
end | ||
|
||
private | ||
|
||
def with_tmp_config(command, args = nil) | ||
Tempfile.open('karma_unit.js', Rails.root.join('tmp') ) do |f| | ||
f.write unit_js(application_spec_files) | ||
f.flush | ||
|
||
system "karma #{command} #{f.path} #{args}" | ||
end | ||
end | ||
|
||
def application_spec_files | ||
sprockets = Rails.application.assets | ||
sprockets.append_path Rails.root.join("spec/karma") | ||
files = Rails.application.assets.find_asset("application_spec.js").to_a.map {|e| e.pathname.to_s } | ||
end | ||
|
||
def unit_js(files) | ||
unit_js = File.open('spec/karma/config/unit.js', 'r').read | ||
unit_js.gsub "APPLICATION_SPEC", "\"#{files.join("\",\n\"")}\"" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "weroom-app", | ||
"dependencies" : { | ||
"karma": ">= 0.10.9", | ||
"karma-jasmine": "0.1.5", | ||
"karma-ng-scenario": "0.1.0", | ||
"phantomjs": "1.9.7-1" | ||
} | ||
} |
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
//= require angular | ||
//= require angular-mocks | ||
//= require application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// Karma configuration | ||
// Generated on Mon Feb 03 2014 16:16:15 GMT+0100 (CET) | ||
|
||
module.exports = function(config) { | ||
config.set({ | ||
|
||
// base path, based on tmp/ folder | ||
basePath: '..', | ||
|
||
|
||
// frameworks to use | ||
frameworks: ['jasmine', 'ng-scenario'], | ||
|
||
|
||
// list of files / patterns to load in the browser | ||
files: [ | ||
"/usr/local/var/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/turbolinks-2.2.1/lib/assets/javascripts/turbolinks.*", | ||
'app/assets/javascripts/angular/*/*.{coffee,js}', | ||
'spec/javascripts/**/*_spec.{coffee,js}' | ||
], | ||
|
||
// list of files to exclude | ||
exclude: [ | ||
|
||
], | ||
|
||
|
||
// test results reporter to use | ||
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' | ||
reporters: ['progress'], | ||
|
||
|
||
// web server port | ||
port: 9876, | ||
|
||
|
||
// enable / disable colors in the output (reporters and logs) | ||
colors: true, | ||
|
||
|
||
// level of logging | ||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG | ||
logLevel: config.LOG_INFO, | ||
|
||
|
||
// enable / disable watching file and executing tests whenever any file changes | ||
autoWatch: true, | ||
|
||
|
||
// Start these browsers, currently available: | ||
// - Chrome | ||
// - ChromeCanary | ||
// - Firefox | ||
// - Opera (has to be installed with `npm install karma-opera-launcher`) | ||
// - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`) | ||
// - PhantomJS | ||
// - IE (only Windows; has to be installed with `npm install karma-ie-launcher`) | ||
browsers: ['PhantomJS'], | ||
|
||
|
||
// If browser does not capture in given timeout [ms], kill it | ||
captureTimeout: 60000, | ||
|
||
|
||
// Continuous Integration mode | ||
// if true, it capture browsers, run tests and exit | ||
singleRun: false, | ||
|
||
// Preprocessors | ||
preprocessors: { | ||
'/**/*.coffee':'coffee' | ||
} | ||
|
||
}); | ||
}; |