Skip to content

Commit

Permalink
Replace jasmine gem with jasmine via karma
Browse files Browse the repository at this point in the history
  • Loading branch information
mbklein committed Nov 19, 2018
1 parent ee0caf8 commit 28c6f72
Show file tree
Hide file tree
Showing 10 changed files with 11,102 additions and 173 deletions.
4 changes: 4 additions & 0 deletions .rubocop.yml
Expand Up @@ -31,6 +31,10 @@ Metrics/BlockLength:
RSpec/NestedGroups:
Enabled: false

RSpec/DescribeClass:
Exclude:
- 'spec/javascripts/**/*'

RSpec/LeadingSubject:
Enabled: false

Expand Down
2 changes: 2 additions & 0 deletions .travis.yml
Expand Up @@ -10,6 +10,7 @@ cache:
before_install:
- gem update --system # https://docs.travis-ci.com/user/languages/ruby/#Upgrading-RubyGems
- gem install bundler
- npm install -g karma karma-jasmine karma-chrome-launcher
- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &

rvm:
Expand All @@ -19,6 +20,7 @@ rvm:

env:
global:
- CHROME_BIN=google-chrome-stable
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
matrix:
- "RAILS_VERSION=5.2.0"
Expand Down
9 changes: 0 additions & 9 deletions Rakefile
Expand Up @@ -6,14 +6,5 @@ Dir.glob('tasks/*.rake').each { |r| import r }

require 'rspec/core/rake_task'
require 'engine_cart/rake_task'
require 'jasmine'
load 'jasmine/tasks/jasmine.rake'

# Set up the test application prior to running jasmine tasks.
task 'jasmine:require' => :setup_test_server
task :setup_test_server do
require 'engine_cart'
EngineCart.load_application!
end

task default: [:ci]
71 changes: 71 additions & 0 deletions karma.conf.js
@@ -0,0 +1,71 @@
// Karma configuration
// Generated on Mon Nov 19 2018 13:01:16 GMT-0600 (Central Standard Time)

module.exports = function(config) {
config.set({

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',


// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],


// list of files / patterns to load in the browser
files: [
'spec/javascripts/helpers/jquery.js',
'app/assets/javascripts/**/*.js',
'spec/javascripts/behavior_spec.js'
],


// list of files / patterns to exclude
exclude: [
],


// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},


// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
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
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['ChromeHeadless'],


// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,

// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
})
}
4 changes: 1 addition & 3 deletions spec/javascripts/behavior_spec.js
@@ -1,9 +1,7 @@
describe("toggleCheckbox", function() {

it("toggles the value between 1 and 0", function() {
it("toggles the value between 1 and 0", function() {
var html = '<input type="checkbox" name="select_all" id="select_all" value="0" class="ev-select-all"/>';
var toggled = $.fn.browseEverything.toggleCheckbox($(html)[0]);
expect($(toggled)[0].value).toEqual("1");
});

});

0 comments on commit 28c6f72

Please sign in to comment.