Class: Opal::RSpec::Runner
- Inherits:
-
Object
- Object
- Opal::RSpec::Runner
- Defined in:
- lib/opal/rspec/runner.rb
Defined Under Namespace
Classes: LegacyServerProxy
Instance Attribute Summary collapse
-
#arity_checking ⇒ Object
Returns the value of attribute arity_checking.
-
#cli_options ⇒ Object
Returns the value of attribute cli_options.
-
#default_path ⇒ Object
Returns the value of attribute default_path.
-
#exclude_pattern ⇒ Object
Returns the value of attribute exclude_pattern.
-
#files ⇒ Object
Returns the value of attribute files.
-
#pattern ⇒ Object
Returns the value of attribute pattern.
-
#requires ⇒ Object
Returns the value of attribute requires.
-
#runner ⇒ Object
Returns the value of attribute runner.
-
#spec_opts ⇒ Object
Returns the value of attribute spec_opts.
Instance Method Summary collapse
- #arity_checking? ⇒ Boolean
- #cli ⇒ Object
- #command ⇒ Object
- #get_load_asset_code(server) ⇒ Object
-
#initialize(&block) ⇒ Runner
constructor
A new instance of Runner.
- #options ⇒ Object
- #run ⇒ Object
- #timeout=(_) ⇒ Object
Constructor Details
#initialize(&block) ⇒ Runner
Returns a new instance of Runner.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/opal/rspec/runner.rb', line 70 def initialize(&block) @legacy_server_proxy = LegacyServerProxy.new block.call(@legacy_server_proxy, self) if block_given? # for compatibility raise 'Cannot supply both a pattern and files!' if self.files and self.pattern locator = ::Opal::RSpec::Locator.new pattern: self.pattern, exclude_pattern: self.exclude_pattern, files: self.files, default_path: self.default_path = [] << '--arity-check' if arity_checking? += ['--runner', runner] unless runner.empty? << '-ropal-rspec' << '--missing-require=ignore' += @legacy_server_proxy. Opal.paths.each { |p| << "-I#{p}" } locator.get_spec_load_paths.each { |p| << "-I#{p}" } requires.each { |p| << "-r#{p}" } locator.get_opal_spec_requires.each { |p| << "-r#{p}" } ::Opal::Config.stubbed_files.each { |p| << "-s#{p}" } += @cli_options if @cli_options bootstrap_code = [ ::Opal::RSpec.spec_opts_code(spec_opts), '::RSpec::Core::Runner.autorun', ].join(';') @args = "#{.map(&:shellescape).join ' '} -e #{bootstrap_code.shellescape}" end |
Instance Attribute Details
#arity_checking ⇒ Object
Returns the value of attribute arity_checking.
11 12 13 |
# File 'lib/opal/rspec/runner.rb', line 11 def arity_checking @arity_checking end |
#cli_options ⇒ Object
Returns the value of attribute cli_options.
11 12 13 |
# File 'lib/opal/rspec/runner.rb', line 11 def @cli_options end |
#default_path ⇒ Object
Returns the value of attribute default_path.
11 12 13 |
# File 'lib/opal/rspec/runner.rb', line 11 def default_path @default_path end |
#exclude_pattern ⇒ Object
Returns the value of attribute exclude_pattern.
11 12 13 |
# File 'lib/opal/rspec/runner.rb', line 11 def exclude_pattern @exclude_pattern end |
#files ⇒ Object
Returns the value of attribute files.
11 12 13 |
# File 'lib/opal/rspec/runner.rb', line 11 def files @files end |
#pattern ⇒ Object
Returns the value of attribute pattern.
11 12 13 |
# File 'lib/opal/rspec/runner.rb', line 11 def pattern @pattern end |
#requires ⇒ Object
Returns the value of attribute requires.
11 12 13 |
# File 'lib/opal/rspec/runner.rb', line 11 def requires @requires end |
#runner ⇒ Object
Returns the value of attribute runner.
11 12 13 |
# File 'lib/opal/rspec/runner.rb', line 11 def runner @runner end |
#spec_opts ⇒ Object
Returns the value of attribute spec_opts.
11 12 13 |
# File 'lib/opal/rspec/runner.rb', line 11 def spec_opts @spec_opts end |
Instance Method Details
#arity_checking? ⇒ Boolean
17 18 19 20 |
# File 'lib/opal/rspec/runner.rb', line 17 def arity_checking? setting = @arity_checking || :enabled setting == :enabled end |
#cli ⇒ Object
124 125 126 |
# File 'lib/opal/rspec/runner.rb', line 124 def cli @cli ||= ::Opal::CLI.new() end |
#command ⇒ Object
112 113 114 |
# File 'lib/opal/rspec/runner.rb', line 112 def command @command ||= "opal #{@args}" end |
#get_load_asset_code(server) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/opal/rspec/runner.rb', line 34 def get_load_asset_code(server) sprockets = server.sprockets name = server.main asset = sprockets[name] raise "Cannot find asset: #{name}" if asset.nil? # Opal::Sprockets.load_asset name, sprockets '' end |
#options ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/opal/rspec/runner.rb', line 100 def { pattern: pattern, exclude_pattern: exclude_pattern, files: files, default_path: default_path, runner: runner, arity_checking: arity_checking, spec_opts: spec_opts, } end |
#run ⇒ Object
128 129 130 131 |
# File 'lib/opal/rspec/runner.rb', line 128 def run ENV['OPAL_CLI_RUNNERS_SERVER_STATIC_FOLDER'] = default_path cli.run end |
#timeout=(_) ⇒ Object
13 14 15 |
# File 'lib/opal/rspec/runner.rb', line 13 def timeout= _ warn "deprecated: setting timeout has no effect" end |