Skip to content

Commit 5b4f6cd

Browse files
committedOct 15, 2014
Some cleanup
1 parent 1603a8c commit 5b4f6cd

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed
 

‎opal/opal/rspec.rb

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ class Unit; end
1717

1818
# Async helpers for specs
1919
config.include Opal::RSpec::AsyncHelpers
20-
config.extend Opal::RSpec::AsyncDefinitions
2120

2221
# Always support expect() and .should syntax (we should not do this really..)
2322
config.expect_with :rspec do |c|

‎opal/opal/rspec/async.rb

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
module Opal
22
module RSpec
3-
module AsyncDefinitions
4-
def async(desc, *args, &block)
5-
options = ::RSpec::Core::Metadata.build_hash_from(args)
6-
Opal::RSpec::AsyncExample.register(self, desc, options, block)
3+
module AsyncHelpers
4+
module ClassMethods
5+
def async(desc, *args, &block)
6+
options = ::RSpec::Core::Metadata.build_hash_from(args)
7+
Opal::RSpec::AsyncExample.register(self, desc, options, block)
8+
end
9+
end
10+
11+
def self.included(base)
12+
base.extend ClassMethods
713
end
8-
end
914

10-
module AsyncHelpers
1115
def async(&block)
1216
@example.continue_async(block)
1317
end

‎spec/async_spec.rb

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
describe "Asynchronous helpers" do
2-
32
let(:foo) { 100 }
43

54
before do
65
@model = Object.new
76
end
87

98
async "can run examples async" do
10-
run_async do
9+
async do
1110
1.should == 1
1211
end
1312
end
1413

1514
async "can access let() helpers and before() helpers" do
16-
run_async do
15+
async do
1716
foo.should eq(100)
1817
@model.should be_kind_of(Object)
1918
end
@@ -23,7 +22,7 @@
2322
obj = [1, 2, 3, 4]
2423

2524
delay(1) do
26-
run_async { obj.should == [1, 2, 3, 4] }
25+
async { obj.should == [1, 2, 3, 4] }
2726
end
2827
end
2928

@@ -33,7 +32,7 @@
3332
}.to raise_error(Exception)
3433

3534
delay(0) do
36-
run_async { expect(42).to eq(42) }
35+
async { expect(42).to eq(42) }
3736
end
3837
end
3938
end

0 commit comments

Comments
 (0)
Please sign in to comment.