opal-minitest 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8a5d0324af8d3dac6776e3a727a02cfce6cc46e3
4
+ data.tar.gz: 7112796e1cc168e535849d757fcb5024046c290d
5
+ SHA512:
6
+ metadata.gz: 4d070c4dcb8bd517c0d662d9b3eae74cdaaf5d87525230ba7a16d36e080abf03cf466f9fcb17e5194a66e84797d11e0b1965ed6c848f19865d8e1a92e5db7d00
7
+ data.tar.gz: 8226d9ec681b510173d8ae24227fbef33c3b36a015535954af2ee504169c28211e3eafca210fb19e4916eef6db58d14206623eeab5c4e8b58f0bbec6d42ebf53
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ Gemfile.lock
2
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # opal-minitest
2
+
3
+ Opal port/utilities for MiniTest.
4
+
5
+ ## Status
6
+
7
+ Currently supports:
8
+
9
+ * Core classes
10
+ * Test (except parallel running, plugins and CLI options)
11
+ * Assertions (except `#capture_subprocess_io`)
12
+
13
+ Any differences from vanilla Minitest are documented with an `OMT` label.
14
+
15
+ ## Usage
16
+
17
+ Add the gem to a project's Gemfile.
18
+
19
+ `gem 'opal-minitest'`
20
+
21
+ Use the Rake task to headlessly runs a project's tests.
22
+
23
+ ```ruby
24
+ # Rakefile
25
+ require 'opal/minitest/rake_task'
26
+ Opal::Minitest::RakeTask.new(:default)
27
+ ```
28
+
29
+ `$ bundle exec rake`
30
+
31
+ This will require standard test_helper and test files and then run all tests.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'opal/minitest/rake_task'
2
+ Opal::MiniTest::RakeTask.new(:default)
data/example/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'opal-minitest', path: '../'
4
+ gem 'minitest', '~> 5.3.2'
data/example/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+ require 'opal/minitest/rake_task'
2
+
3
+ # Register code in /opal with Opal.
4
+ Opal.append_path File.expand_path('../opal', __FILE__)
5
+
6
+ Opal::MiniTest::RakeTask.new(:default)
7
+
8
+
9
+ desc "Run tests through regular Minitest"
10
+ task('regtest') do
11
+ require 'minitest'
12
+ require 'minitest/autorun'
13
+
14
+ %w[opal test].each { |p| $LOAD_PATH << p }
15
+
16
+ Dir['test/**/*_test.rb'].each { |f| require_relative f }
17
+ end
@@ -0,0 +1,5 @@
1
+ class Bacterium
2
+ def reproduce
3
+ self.class.new
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ require 'bacterium'
2
+
3
+ class BacteriumTest < Minitest::Test
4
+ def setup
5
+ @object = Bacterium.new
6
+ end
7
+
8
+ def test_reproduce_returns_genetic_clone
9
+ assert_equal(@object.reproduce.class, @object.class)
10
+ end
11
+ end
@@ -0,0 +1,45 @@
1
+ require 'opal/minitest'
2
+
3
+ module Opal
4
+ module MiniTest
5
+ class RakeTask
6
+ include Rake::DSL
7
+
8
+ PORT = 2838
9
+ RUNNER = File.expand_path('../../../../vendor/runner.js', __FILE__)
10
+
11
+ def initialize(name = 'opal:minitest')
12
+ desc "Run tests through opal-minitest"
13
+ task(name) do
14
+ require 'rack'
15
+ require 'webrick'
16
+
17
+ server = fork {
18
+ Rack::Server.start(
19
+ app: Server.new,
20
+ Port: PORT,
21
+ server: 'webrick',
22
+ Logger: WEBrick::Log.new('/dev/null'),
23
+ AccessLog: [])
24
+ }
25
+
26
+ system "phantomjs #{RUNNER} \"http://localhost:#{PORT}\""
27
+
28
+ Process.kill(:SIGINT, server)
29
+ Process.wait
30
+ end
31
+ end
32
+
33
+ class Server < Opal::Server
34
+ def initialize
35
+ super
36
+
37
+ $LOAD_PATH.each { |p| append_path(p) }
38
+ append_path 'test'
39
+ self.main = 'opal/minitest/loader'
40
+ self.debug = false
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,5 @@
1
+ module Opal
2
+ module Minitest
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ require 'opal'
2
+
3
+ # Register code in /opal with Opal.
4
+ Opal.append_path File.expand_path('../../../opal', __FILE__)