opal-rspec 0.7.0 → 0.8.0.alpha3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1cc133e9e68247ec3724254799c05ae252b3997be94713206f2668ea50bab6c9
4
- data.tar.gz: dbe4d9ff976f2b02eb9c06da3d4087e5e85559ef2c212f9ac3bda5f01daf98cc
3
+ metadata.gz: 751a4d8835f7dcf0029ea1f72ce437b9227536aa94defcb56a31417c2dbf9450
4
+ data.tar.gz: cb0943ced8b2e76759fe93c9384e6b66d3d22d9caff893aea304c73ebf9b4d9b
5
5
  SHA512:
6
- metadata.gz: f58ff1127357c59a61b7b50210495d5c5ec7a826d7366e43709d358107b9579379f215a109cc1269ae837f0e867c80ebfd8945b81b1d6476045421e55e33eac9
7
- data.tar.gz: a013b85ed190c2c38965641de42f4d849552c4de3c7e843e3cc53583d887f45823aaf73ddab84c1db307326a2cb9c3c4ba62271dc801c8f1a77ac9c815ad0b4a
6
+ metadata.gz: a9dc4804ce2ff91a3edc36aa6fc86e8fe83facb6274e7dfe49e403dbcfefb2672e7db4ab82d9beaa292428d131ed9cba820e6cbf07354dcc758a24d0a97c1ba4
7
+ data.tar.gz: 44cdb0f61f64898b4fbf124ec4f6ebcbc3620a069c1e37944a3469aa1067f8d9a8b4954bfc5502949964d3247ffbc5dee17cd1fec4191d65acab605b2c57ca0d
@@ -0,0 +1,36 @@
1
+ name: ubuntu
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ - "*-stable"
8
+ - "*ci-check"
9
+ pull_request:
10
+ branches:
11
+ - master
12
+
13
+ jobs:
14
+ build:
15
+ strategy:
16
+ matrix:
17
+ os: [ 'ubuntu-latest' ]
18
+ ruby: [ 2.7, 2.6, 2.5, ruby-head ]
19
+ opal: [ 1.0.3 ]
20
+
21
+ runs-on: ${{ matrix.os }}
22
+
23
+ env:
24
+ OPAL_VERSION: ${{ matrix.opal }}
25
+
26
+ steps:
27
+ - uses: actions/checkout@v2
28
+ - uses: ruby/setup-ruby@v1
29
+ with:
30
+ ruby-version: ${{ matrix.ruby }}
31
+ - name: Setup project
32
+ run: bin/setup
33
+ - name: Run test
34
+ run:
35
+ - "bundle exec exe/opal-rspec spec-opal-passing"
36
+ - "bundle exec rspec"
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ # Opal-RSpec Changelog
2
+
3
+ ## 0.8.0 - unreleased
4
+
5
+ - Support for Opal v1.x
6
+
7
+ - Fix some x-srting semicolon warnings
8
+
9
+ - Fix forwarding the exit code to the rake task
10
+
11
+
12
+ ## 0.7.1 - 2019-02-04
13
+
14
+ - add a project initializer: `opal-rspec --init`
15
+
16
+
1
17
  ## 0.7.0 - 2019-02-03
2
18
 
3
19
  - Drop support for the legacy async syntax
data/README.md CHANGED
@@ -6,8 +6,6 @@
6
6
 
7
7
  An attempt at a compatibility layer of RSpec for Opal.
8
8
 
9
- #### For the README for the latest release, click [here](https://github.com/opal/opal-rspec/blob/releases/0-6-stable/README.md).
10
-
11
9
  ## Usage
12
10
 
13
11
  Add `opal-rspec` to your Gemfile:
@@ -16,6 +14,26 @@ Add `opal-rspec` to your Gemfile:
16
14
  gem 'opal-rspec'
17
15
  ```
18
16
 
17
+ *(since v0.7.1)*
18
+
19
+ Then type `opal-rspec --init`, this command will create a `spec-opal/` folder for you with a minimal `spec_helper.rb` file. At this point you can write your first opal-spec!
20
+
21
+ _spec-opal/simple_sum_spec.rb_
22
+
23
+ ```rb
24
+ RSpec.describe 'a simple sum' do
25
+ it 'equals two!' do
26
+ expect(1 + 1).to eq(2)
27
+ end
28
+ end
29
+ ```
30
+
31
+ To run your specs, simply type:
32
+
33
+ ```bash
34
+ bundle exec opal-rspec --color spec-opal/
35
+ ```
36
+
19
37
  ## Requirements
20
38
 
21
39
  Besides what's already reflected in the GEM dependencies:
data/exe/opal-rspec CHANGED
@@ -10,6 +10,11 @@ require 'optparse'
10
10
 
11
11
  options = {}
12
12
  OptionParser.new do |parser|
13
+ parser.on('--init', 'Initialize your project with Opal-RSpec.') do |_cmd|
14
+ Opal::RSpec::ProjectInitializer.new.run
15
+ exit
16
+ end
17
+
13
18
  parser.on('-c', '--[no-]color', '--[no-]colour', 'Enable color in the output.') do |o|
14
19
  options[:color] = o
15
20
  end
@@ -23,17 +28,21 @@ OptionParser.new do |parser|
23
28
  options[:formatters] ||= []
24
29
  options[:formatters] << [o]
25
30
  end
31
+
26
32
  parser.on('-r', '--require PATH', 'Require a file.') do |path|
27
33
  options[:requires] ||= []
28
34
  options[:requires] << path
29
35
  end
36
+
30
37
  parser.on('-I PATH', 'Specify PATH to add to $LOAD_PATH (may be used more than once).') do |dir|
31
38
  options[:includes] ||= []
32
39
  options[:includes] << dir
33
40
  end
41
+
34
42
  parser.on('-P', '--pattern PATTERN', 'Load files matching pattern (default: "spec-opal/**/*_spec.rb").') do |o|
35
43
  options[:pattern] = o
36
44
  end
45
+
37
46
  parser.on('--default-path PATH', 'Set the default path where RSpec looks for examples (can',
38
47
  ' be a path to a file or a directory).') do |path|
39
48
  options[:default_path] = path
@@ -44,9 +53,7 @@ OptionParser.new do |parser|
44
53
  parser.on('-R', '--runner NAME', 'Use a different JS runner (default is nodejs)') do |name|
45
54
  options[:runner] = name
46
55
  end
47
-
48
56
  end.parse!
49
- # p options: options
50
57
 
51
58
  runner = Opal::RSpec::Runner.new do |server, config|
52
59
  spec_opts = []
@@ -55,7 +62,8 @@ runner = Opal::RSpec::Runner.new do |server, config|
55
62
  raise "can accept only one formatter at this time" if options[:formatters] && options[:formatters].size != 1
56
63
  spec_opts += ['--format', options[:formatters].flatten.first] if options[:formatters]
57
64
  raw_files = ARGV
58
- # p raw_files: ARGV
65
+ raw_files = ['spec-opal'] if raw_files.empty?
66
+
59
67
  files = raw_files.flat_map do |file|
60
68
  if File.directory? file
61
69
  Dir[File.join(file, '**{,/*/**}/*_spec{.js,}.rb')]
@@ -65,7 +73,6 @@ runner = Opal::RSpec::Runner.new do |server, config|
65
73
  raise "Can't stat path: #{file}"
66
74
  end
67
75
  end
68
- # p files: files
69
76
 
70
77
  options[:includes].each {|dir| server.append_path dir} if options[:includes]
71
78
  config.default_path = options[:default_path] if options[:default_path]
@@ -73,6 +80,5 @@ runner = Opal::RSpec::Runner.new do |server, config|
73
80
  config.files = files
74
81
  end
75
82
 
76
- # puts runner.command
77
83
  runner.run
78
84
 
@@ -4,7 +4,7 @@ module Opal
4
4
  include IO::Writable
5
5
 
6
6
  def initialize
7
- `document.open();`
7
+ `document.open()`
8
8
  end
9
9
 
10
10
  def close
data/lib/opal/rspec.rb CHANGED
@@ -18,6 +18,8 @@ Opal::Config.dynamic_require_severity = :ignore
18
18
 
19
19
  module Opal
20
20
  module RSpec
21
+ autoload :ProjectInitializer, 'opal/rspec/project_initializer'
22
+
21
23
  def self.spec_opts_code(spec_opts)
22
24
  code = []
23
25
  if spec_opts && !spec_opts.empty?
@@ -9,7 +9,8 @@ module Opal
9
9
  class Locator
10
10
  include ::RSpec::Core::RubyProject
11
11
 
12
- DEFAULT_PATTERN = 'spec-opal/**/*_spec{.js,}.{rb,opal}'
12
+ DEFAULT_GLOB = '**{,/*/**}/*_spec{.js,}.{rb,opal}'
13
+ DEFAULT_PATTERN = "spec-opal/#{DEFAULT_GLOB}"
13
14
  DEFAULT_DEFAULT_PATH = 'spec-opal'
14
15
 
15
16
  attr_accessor :spec_pattern, :spec_exclude_pattern, :spec_files, :default_path
@@ -0,0 +1,48 @@
1
+ require 'fileutils'
2
+
3
+ module Opal
4
+ module RSpec
5
+ # @private
6
+ # Generates conventional files for an rspec project
7
+ class ProjectInitializer
8
+ attr_reader :destination, :stream, :template_path
9
+
10
+ DOT_RSPEC_FILE = '.rspec-opal'
11
+ SPEC_HELPER_FILE = 'spec-opal/spec_helper.rb'
12
+
13
+ def initialize(opts={})
14
+ @destination = opts.fetch(:destination, Dir.getwd)
15
+ @stream = opts.fetch(:report_stream, $stdout)
16
+ @template_path = opts.fetch(:template_path) do
17
+ File.expand_path("../project_initializer", __FILE__)
18
+ end
19
+ end
20
+
21
+ def run
22
+ copy_template DOT_RSPEC_FILE
23
+ copy_template SPEC_HELPER_FILE
24
+ end
25
+
26
+ private
27
+
28
+ def copy_template(file)
29
+ destination_file = File.join(destination, file)
30
+ return report_exists(file) if File.exist?(destination_file)
31
+
32
+ report_creating(file)
33
+ FileUtils.mkdir_p(File.dirname(destination_file))
34
+ File.open(destination_file, 'w') do |f|
35
+ f.write File.read(File.join(template_path, file))
36
+ end
37
+ end
38
+
39
+ def report_exists(file)
40
+ stream.puts " exist #{file}"
41
+ end
42
+
43
+ def report_creating(file)
44
+ stream.puts " create #{file}"
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
@@ -0,0 +1,13 @@
1
+ RSpec.configure do |config|
2
+ # Run specs in random order to surface order dependencies. If you find an
3
+ # order dependency and want to debug it, you can fix the order by providing
4
+ # the seed, which is printed after each run.
5
+ # --seed 1234
6
+ config.order = :random
7
+
8
+ # Seed global randomization in this process using the `--seed` CLI option.
9
+ # Setting this allows you to use `--seed` to deterministically reproduce
10
+ # test failures related to randomization by passing the same `--seed` value
11
+ # as the one that triggered the failure.
12
+ Kernel.srand config.seed
13
+ end
@@ -12,8 +12,7 @@ module Opal
12
12
  runner = ::Opal::RSpec::Runner.new(&block)
13
13
  desc 'Run Opal specs'
14
14
  @rake_task = task name do
15
- # sh runner.command
16
- runner.run
15
+ exit runner.run
17
16
  end
18
17
  end
19
18
  end
@@ -1,5 +1,5 @@
1
1
  module Opal
2
2
  module RSpec
3
- VERSION = '0.7.0'
3
+ VERSION = '0.8.0.alpha3'
4
4
  end
5
5
  end
data/opal-rspec.gemspec CHANGED
@@ -24,14 +24,13 @@ Gem::Specification.new do |spec|
24
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
25
  spec.require_paths = ["lib"]
26
26
 
27
- spec.add_dependency 'opal', ['>= 0.11', '< 0.12']
28
- spec.add_dependency 'opal-sprockets'
29
- spec.add_dependency 'rake', '~> 12.0'
27
+ spec.add_dependency 'opal', ['>= 1.0.0', '< 2.0']
28
+ spec.add_dependency 'opal-sprockets', '< 2.0'
29
+ spec.add_dependency 'rake', '>= 12.0'
30
30
 
31
- spec.add_development_dependency 'bundler', '~> 1.15'
31
+ spec.add_development_dependency 'bundler'
32
32
  spec.add_development_dependency 'yard'
33
- spec.add_development_dependency 'chromedriver-helper'
34
- spec.add_development_dependency 'selenium-webdriver'
33
+ spec.add_development_dependency 'apparition'
35
34
  spec.add_development_dependency 'capybara'
36
35
  spec.add_development_dependency 'launchy'
37
36
  spec.add_development_dependency 'appraisal'
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opal-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0.alpha3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Beynon
8
8
  - Brady Wied
9
9
  - Elia Schito
10
- autorequire:
10
+ autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2019-02-03 00:00:00.000000000 Z
13
+ date: 2021-07-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: opal
@@ -18,64 +18,50 @@ dependencies:
18
18
  requirements:
19
19
  - - ">="
20
20
  - !ruby/object:Gem::Version
21
- version: '0.11'
21
+ version: 1.0.0
22
22
  - - "<"
23
23
  - !ruby/object:Gem::Version
24
- version: '0.12'
24
+ version: '2.0'
25
25
  type: :runtime
26
26
  prerelease: false
27
27
  version_requirements: !ruby/object:Gem::Requirement
28
28
  requirements:
29
29
  - - ">="
30
30
  - !ruby/object:Gem::Version
31
- version: '0.11'
31
+ version: 1.0.0
32
32
  - - "<"
33
33
  - !ruby/object:Gem::Version
34
- version: '0.12'
34
+ version: '2.0'
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: opal-sprockets
37
37
  requirement: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">="
39
+ - - "<"
40
40
  - !ruby/object:Gem::Version
41
- version: '0'
41
+ version: '2.0'
42
42
  type: :runtime
43
43
  prerelease: false
44
44
  version_requirements: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ">="
46
+ - - "<"
47
47
  - !ruby/object:Gem::Version
48
- version: '0'
48
+ version: '2.0'
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: rake
51
51
  requirement: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - "~>"
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '12.0'
56
56
  type: :runtime
57
57
  prerelease: false
58
58
  version_requirements: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - "~>"
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: '12.0'
63
63
  - !ruby/object:Gem::Dependency
64
64
  name: bundler
65
- requirement: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - "~>"
68
- - !ruby/object:Gem::Version
69
- version: '1.15'
70
- type: :development
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - "~>"
75
- - !ruby/object:Gem::Version
76
- version: '1.15'
77
- - !ruby/object:Gem::Dependency
78
- name: yard
79
65
  requirement: !ruby/object:Gem::Requirement
80
66
  requirements:
81
67
  - - ">="
@@ -89,7 +75,7 @@ dependencies:
89
75
  - !ruby/object:Gem::Version
90
76
  version: '0'
91
77
  - !ruby/object:Gem::Dependency
92
- name: chromedriver-helper
78
+ name: yard
93
79
  requirement: !ruby/object:Gem::Requirement
94
80
  requirements:
95
81
  - - ">="
@@ -103,7 +89,7 @@ dependencies:
103
89
  - !ruby/object:Gem::Version
104
90
  version: '0'
105
91
  - !ruby/object:Gem::Dependency
106
- name: selenium-webdriver
92
+ name: apparition
107
93
  requirement: !ruby/object:Gem::Requirement
108
94
  requirements:
109
95
  - - ">="
@@ -167,10 +153,10 @@ extensions: []
167
153
  extra_rdoc_files: []
168
154
  files:
169
155
  - ".codeclimate.yml"
156
+ - ".github/workflows/build.yml"
170
157
  - ".gitignore"
171
158
  - ".gitmodules"
172
159
  - ".rspec"
173
- - ".travis.yml"
174
160
  - ".yardopts"
175
161
  - Appraisals
176
162
  - CHANGELOG.md
@@ -262,6 +248,9 @@ files:
262
248
  - lib/opal/rspec.rb
263
249
  - lib/opal/rspec/cached_environment.rb
264
250
  - lib/opal/rspec/locator.rb
251
+ - lib/opal/rspec/project_initializer.rb
252
+ - lib/opal/rspec/project_initializer/.rspec-opal
253
+ - lib/opal/rspec/project_initializer/spec-opal/spec_helper.rb
265
254
  - lib/opal/rspec/rake_task.rb
266
255
  - lib/opal/rspec/runner.rb
267
256
  - lib/opal/rspec/sprockets_environment.rb
@@ -756,7 +745,7 @@ homepage: https://github.com/opal/opal-rspec
756
745
  licenses:
757
746
  - MIT
758
747
  metadata: {}
759
- post_install_message:
748
+ post_install_message:
760
749
  rdoc_options: []
761
750
  require_paths:
762
751
  - lib
@@ -767,13 +756,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
767
756
  version: '0'
768
757
  required_rubygems_version: !ruby/object:Gem::Requirement
769
758
  requirements:
770
- - - ">="
759
+ - - ">"
771
760
  - !ruby/object:Gem::Version
772
- version: '0'
761
+ version: 1.3.1
773
762
  requirements: []
774
- rubyforge_project:
775
- rubygems_version: 2.7.7
776
- signing_key:
763
+ rubygems_version: 3.2.15
764
+ signing_key:
777
765
  specification_version: 4
778
766
  summary: RSpec for Opal
779
767
  test_files: []
data/.travis.yml DELETED
@@ -1,62 +0,0 @@
1
- language: ruby
2
- sudo: false
3
-
4
- cache:
5
- bundler: true
6
- directories:
7
- - node_modules
8
- - phantom20
9
-
10
- matrix:
11
- include:
12
- # - rvm: 2.5.1
13
- # - rvm: 2.4.2
14
- # - rvm: 2.3.7
15
- # - rvm: 2.4.1
16
- # # PHANTOMJS env variable is not used but it makes it easier to differentiate this build in Travis
17
- # env: PHANTOMJS=2.1 RUN=rake_only
18
- # before_install:
19
- # # Attempt to work around Travis issues and Ruby 2.3 - https://github.com/vcr/vcr/issues/582
20
- # - gem update --system
21
- # - "export PATH=`pwd`/node_modules/phantomjs-prebuilt/bin:$PATH"
22
- # - "echo $PATH"
23
- # - phantomjs -v | grep 2.1 || npm install phantomjs-prebuilt # get rate limits from bitbucket download source, so get from NPM if we don't have it already
24
- # - rvm: 2.4.1
25
- # env: RUNNER=node RUN=rake_only
26
- # - rvm: 2.5.1
27
- # env: RUN=rspec
28
- # gemfile: gemfiles/opal_master.gemfile
29
- # - rvm: 2.5.1
30
- # env: RUN=rspec
31
- # gemfile: gemfiles/opal_0.10_stable.gemfile
32
-
33
- allow_failures:
34
- - gemfile: gemfiles/opal_master.gemfile
35
-
36
- gemfile:
37
- - gemfiles/opal_0.11.gemfile
38
- - gemfiles/opal_master.gemfile
39
-
40
- before_install:
41
- # Attempt to work around Travis issues and Ruby 2.3 - https://github.com/vcr/vcr/issues/582
42
- - gem update --system
43
- - gem install bundler
44
- - "mkdir -p phantom20"
45
- - "export PATH=`pwd`/phantom20:$PATH"
46
- - "echo $PATH"
47
- - "pushd phantom20"
48
- - "ls phantomjs || curl -L -O https://s3.amazonaws.com/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2"
49
- - "ls phantomjs || tar xjvf phantomjs-2.0.0-ubuntu-12.04.tar.bz2"
50
- - "rm -rf phantomjs-2.0.0-ubuntu-12.04.tar.bz2"
51
- - "popd"
52
-
53
- # before_script:
54
- # - "export DISPLAY=:99.0"
55
- # - "sh -e /etc/init.d/xvfb start"
56
- # - "phantomjs -v"
57
- # - "node -v"
58
- # - "firefox --version"
59
-
60
- script:
61
- - "bundle exec exe/opal-rspec spec-opal-passing"
62
- - "bundle exec rspec"