Skip to content

Commit 28c6f72

Browse files
committed
Replace jasmine gem with jasmine via karma
1 parent ee0caf8 commit 28c6f72

File tree

10 files changed

+11102
-173
lines changed

10 files changed

+11102
-173
lines changed

.rubocop.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ Metrics/BlockLength:
3131
RSpec/NestedGroups:
3232
Enabled: false
3333

34+
RSpec/DescribeClass:
35+
Exclude:
36+
- 'spec/javascripts/**/*'
37+
3438
RSpec/LeadingSubject:
3539
Enabled: false
3640

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ cache:
1010
before_install:
1111
- gem update --system # https://docs.travis-ci.com/user/languages/ruby/#Upgrading-RubyGems
1212
- gem install bundler
13+
- npm install -g karma karma-jasmine karma-chrome-launcher
1314
- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
1415

1516
rvm:
@@ -19,6 +20,7 @@ rvm:
1920

2021
env:
2122
global:
23+
- CHROME_BIN=google-chrome-stable
2224
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
2325
matrix:
2426
- "RAILS_VERSION=5.2.0"

Rakefile

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,5 @@ Dir.glob('tasks/*.rake').each { |r| import r }
66

77
require 'rspec/core/rake_task'
88
require 'engine_cart/rake_task'
9-
require 'jasmine'
10-
load 'jasmine/tasks/jasmine.rake'
11-
12-
# Set up the test application prior to running jasmine tasks.
13-
task 'jasmine:require' => :setup_test_server
14-
task :setup_test_server do
15-
require 'engine_cart'
16-
EngineCart.load_application!
17-
end
189

1910
task default: [:ci]

karma.conf.js

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// Karma configuration
2+
// Generated on Mon Nov 19 2018 13:01:16 GMT-0600 (Central Standard Time)
3+
4+
module.exports = function(config) {
5+
config.set({
6+
7+
// base path that will be used to resolve all patterns (eg. files, exclude)
8+
basePath: '',
9+
10+
11+
// frameworks to use
12+
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
13+
frameworks: ['jasmine'],
14+
15+
16+
// list of files / patterns to load in the browser
17+
files: [
18+
'spec/javascripts/helpers/jquery.js',
19+
'app/assets/javascripts/**/*.js',
20+
'spec/javascripts/behavior_spec.js'
21+
],
22+
23+
24+
// list of files / patterns to exclude
25+
exclude: [
26+
],
27+
28+
29+
// preprocess matching files before serving them to the browser
30+
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
31+
preprocessors: {
32+
},
33+
34+
35+
// test results reporter to use
36+
// possible values: 'dots', 'progress'
37+
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
38+
reporters: ['progress'],
39+
40+
41+
// web server port
42+
port: 9876,
43+
44+
45+
// enable / disable colors in the output (reporters and logs)
46+
colors: true,
47+
48+
49+
// level of logging
50+
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
51+
logLevel: config.LOG_INFO,
52+
53+
54+
// enable / disable watching file and executing tests whenever any file changes
55+
autoWatch: true,
56+
57+
58+
// start these browsers
59+
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
60+
browsers: ['ChromeHeadless'],
61+
62+
63+
// Continuous Integration mode
64+
// if true, Karma captures browsers, runs the tests and exits
65+
singleRun: true,
66+
67+
// Concurrency level
68+
// how many browser should be started simultaneous
69+
concurrency: Infinity
70+
})
71+
}

spec/javascripts/behavior_spec.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
describe("toggleCheckbox", function() {
2-
3-
it("toggles the value between 1 and 0", function() {
2+
it("toggles the value between 1 and 0", function() {
43
var html = '<input type="checkbox" name="select_all" id="select_all" value="0" class="ev-select-all"/>';
54
var toggled = $.fn.browseEverything.toggleCheckbox($(html)[0]);
65
expect($(toggled)[0].value).toEqual("1");
76
});
8-
97
});

0 commit comments

Comments
 (0)