Skip to content

Commit

Permalink
Update opal-rspec and move specs to spec-opal
Browse files Browse the repository at this point in the history
Also fix alert spec not to block excecution on chrome.
  • Loading branch information
elia committed Jul 23, 2018
1 parent 78ef7ed commit d15ca70
Show file tree
Hide file tree
Showing 37 changed files with 33 additions and 14 deletions.
14 changes: 8 additions & 6 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@ require 'bundler'
Bundler.require
Bundler::GemHelper.install_tasks

ENV['RUNNER'] = 'chrome'

require 'opal/rspec/rake_task'
Opal::RSpec::RakeTask.new(:default) do |server, task|
server.index_path = 'spec/jquery/index.html.erb'
task.default_path = 'spec'
server.index_path = 'spec-opal/jquery/index.html.erb'
task.default_path = 'spec-opal'
end

Opal::RSpec::RakeTask.new(:jquery3) do |server, task|
server.index_path = 'spec/jquery/index3.html.erb'
task.default_path = 'spec'
server.index_path = 'spec-opal/jquery/index3.html.erb'
task.default_path = 'spec-opal'
end

Opal::RSpec::RakeTask.new(:zepto) do |server, task|
server.index_path = 'spec/zepto/index.html.erb'
task.default_path = 'spec'
server.index_path = 'spec-opal/zepto/index.html.erb'
task.default_path = 'spec-opal'
end

desc "Build build/opal-jquery.js"
Expand Down
2 changes: 1 addition & 1 deletion opal-jquery.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Gem::Specification.new do |s|
s.require_paths = ['lib']

s.add_runtime_dependency 'opal', '>= 0.10.0', '< 0.12.0'
s.add_development_dependency 'opal-rspec', '~> 0.6.0'
s.add_development_dependency 'opal-rspec', '~> 0.7.0.rc.2'
s.add_development_dependency 'opal-sprockets', '~> 0.4.1'
s.add_development_dependency 'yard'
s.add_development_dependency 'rake'
Expand Down
1 change: 1 addition & 0 deletions spec/document_spec.rb → spec-opal/document_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
end

describe "ready" do
p self.ancestors
async "resolves when document is ready" do
Document.ready.then do
async { Document.ready.resolved?.should be_truthy }
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions spec-opal/kernel_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'spec_helper'

RSpec.describe 'Kernel#alert' do
it 'returns nil' do
begin
original_alert = `window.alert`
message = nil
`window.alert = function(string) { message = string; }`
Kernel.alert('a message').should be_nil
expect(message).to eq('a message')
ensure
`window.alert = #{original_alert}`
end
end
end
File renamed without changes.
8 changes: 8 additions & 0 deletions spec/spec_helper.rb → spec-opal/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ def find(selector)
end
end

module SkipAsync
def async(*args, &block)
xit(*args, &block)
end
end

RSpec.configure do |config|
config.include JQueryTestHelpers
config.extend SkipAsync
config.formatter = :doc
config.color = true
end
File renamed without changes.
File renamed without changes.
7 changes: 0 additions & 7 deletions spec/kernel_spec.rb

This file was deleted.

0 comments on commit d15ca70

Please sign in to comment.