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
- #file_source_embed? ⇒ Boolean
- #get_load_asset_code(server) ⇒ Object
-
#initialize(&block) ⇒ Runner
constructor
A new instance of Runner.
- #options ⇒ Object
- #run ⇒ Object
- #source_location? ⇒ Boolean
- #timeout=(_) ⇒ Object
Constructor Details
#initialize(&block) ⇒ Runner
Returns a new instance of Runner.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/opal/rspec/runner.rb', line 79 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? << '--enable-source-location' if source_location? << '--enable-file-source-embed' if += ['--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.
12 13 14 |
# File 'lib/opal/rspec/runner.rb', line 12 def arity_checking @arity_checking end |
#cli_options ⇒ Object
Returns the value of attribute cli_options.
12 13 14 |
# File 'lib/opal/rspec/runner.rb', line 12 def @cli_options end |
#default_path ⇒ Object
Returns the value of attribute default_path.
12 13 14 |
# File 'lib/opal/rspec/runner.rb', line 12 def default_path @default_path end |
#exclude_pattern ⇒ Object
Returns the value of attribute exclude_pattern.
12 13 14 |
# File 'lib/opal/rspec/runner.rb', line 12 def exclude_pattern @exclude_pattern end |
#files ⇒ Object
Returns the value of attribute files.
12 13 14 |
# File 'lib/opal/rspec/runner.rb', line 12 def files @files end |
#pattern ⇒ Object
Returns the value of attribute pattern.
12 13 14 |
# File 'lib/opal/rspec/runner.rb', line 12 def pattern @pattern end |
#requires ⇒ Object
Returns the value of attribute requires.
12 13 14 |
# File 'lib/opal/rspec/runner.rb', line 12 def requires @requires end |
#runner ⇒ Object
Returns the value of attribute runner.
12 13 14 |
# File 'lib/opal/rspec/runner.rb', line 12 def runner @runner end |
#spec_opts ⇒ Object
Returns the value of attribute spec_opts.
12 13 14 |
# File 'lib/opal/rspec/runner.rb', line 12 def spec_opts @spec_opts end |
Instance Method Details
#arity_checking? ⇒ Boolean
18 19 20 21 |
# File 'lib/opal/rspec/runner.rb', line 18 def arity_checking? setting = @arity_checking || :enabled setting == :enabled end |
#cli ⇒ Object
135 136 137 |
# File 'lib/opal/rspec/runner.rb', line 135 def cli @cli ||= ::Opal::CLI.new() end |
#command ⇒ Object
123 124 125 |
# File 'lib/opal/rspec/runner.rb', line 123 def command @command ||= "opal #{@args}" end |
#file_source_embed? ⇒ Boolean
27 28 29 |
# File 'lib/opal/rspec/runner.rb', line 27 def :enabled end |
#get_load_asset_code(server) ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/opal/rspec/runner.rb', line 43 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
111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/opal/rspec/runner.rb', line 111 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
139 140 141 142 |
# File 'lib/opal/rspec/runner.rb', line 139 def run ENV['OPAL_CLI_RUNNERS_SERVER_STATIC_FOLDER'] = default_path cli.run end |
#source_location? ⇒ Boolean
23 24 25 |
# File 'lib/opal/rspec/runner.rb', line 23 def source_location? :enabled end |
#timeout=(_) ⇒ Object
14 15 16 |
# File 'lib/opal/rspec/runner.rb', line 14 def timeout= _ warn "deprecated: setting timeout has no effect" end |