opal-rspec-cj 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/.gitmodules +15 -0
- data/.travis.yml +13 -0
- data/.yardopts +5 -0
- data/CHANGELOG.md +25 -0
- data/Gemfile +8 -0
- data/README.md +147 -0
- data/Rakefile +26 -0
- data/config.ru +10 -0
- data/example/Gemfile +4 -0
- data/example/README.md +13 -0
- data/example/Rakefile +8 -0
- data/example/opal/user.rb +11 -0
- data/example/spec/user_spec.rb +15 -0
- data/lib/opal-rspec.rb +2 -0
- data/lib/opal/rspec.rb +20 -0
- data/lib/opal/rspec/rake_task.rb +63 -0
- data/lib/opal/rspec/version.rb +5 -0
- data/opal-rspec.gemspec +21 -0
- data/opal/opal-rspec.rb +1 -0
- data/opal/opal/rspec.rb +25 -0
- data/opal/opal/rspec/async.rb +289 -0
- data/opal/opal/rspec/browser_formatter.rb +188 -0
- data/opal/opal/rspec/fixes.rb +116 -0
- data/opal/opal/rspec/requires.rb +45 -0
- data/opal/opal/rspec/runner.rb +69 -0
- data/opal/opal/rspec/sprockets_runner.rb.erb +11 -0
- data/opal/opal/rspec/text_formatter.rb +74 -0
- data/spec/async_spec.rb +38 -0
- data/spec/example_spec.rb +163 -0
- data/spec/matchers_spec.rb +201 -0
- data/spec/mock_spec.rb +63 -0
- data/spec/named_subject_spec.rb +11 -0
- data/spec/should_syntax_spec.rb +17 -0
- data/vendor/spec_runner.js +50 -0
- data/vendor_lib/rspec-expectations.rb +1 -0
- data/vendor_lib/rspec.rb +3 -0
- data/vendor_lib/rspec/autorun.rb +2 -0
- data/vendor_lib/rspec/core.rb +203 -0
- data/vendor_lib/rspec/core/backport_random.rb +302 -0
- data/vendor_lib/rspec/core/backtrace_formatter.rb +65 -0
- data/vendor_lib/rspec/core/command_line.rb +36 -0
- data/vendor_lib/rspec/core/configuration.rb +1129 -0
- data/vendor_lib/rspec/core/configuration_options.rb +143 -0
- data/vendor_lib/rspec/core/drb_command_line.rb +26 -0
- data/vendor_lib/rspec/core/drb_options.rb +87 -0
- data/vendor_lib/rspec/core/dsl.rb +26 -0
- data/vendor_lib/rspec/core/example.rb +312 -0
- data/vendor_lib/rspec/core/example_group.rb +540 -0
- data/vendor_lib/rspec/core/filter_manager.rb +224 -0
- data/vendor_lib/rspec/core/flat_map.rb +17 -0
- data/vendor_lib/rspec/core/formatters.rb +54 -0
- data/vendor_lib/rspec/core/formatters/base_formatter.rb +291 -0
- data/vendor_lib/rspec/core/formatters/base_text_formatter.rb +307 -0
- data/vendor_lib/rspec/core/formatters/deprecation_formatter.rb +193 -0
- data/vendor_lib/rspec/core/formatters/documentation_formatter.rb +67 -0
- data/vendor_lib/rspec/core/formatters/helpers.rb +82 -0
- data/vendor_lib/rspec/core/formatters/html_formatter.rb +155 -0
- data/vendor_lib/rspec/core/formatters/html_printer.rb +408 -0
- data/vendor_lib/rspec/core/formatters/json_formatter.rb +99 -0
- data/vendor_lib/rspec/core/formatters/progress_formatter.rb +32 -0
- data/vendor_lib/rspec/core/formatters/snippet_extractor.rb +101 -0
- data/vendor_lib/rspec/core/hooks.rb +535 -0
- data/vendor_lib/rspec/core/memoized_helpers.rb +431 -0
- data/vendor_lib/rspec/core/metadata.rb +313 -0
- data/vendor_lib/rspec/core/mocking/with_absolutely_nothing.rb +11 -0
- data/vendor_lib/rspec/core/mocking/with_flexmock.rb +27 -0
- data/vendor_lib/rspec/core/mocking/with_mocha.rb +52 -0
- data/vendor_lib/rspec/core/mocking/with_rr.rb +27 -0
- data/vendor_lib/rspec/core/mocking/with_rspec.rb +27 -0
- data/vendor_lib/rspec/core/option_parser.rb +234 -0
- data/vendor_lib/rspec/core/ordering.rb +154 -0
- data/vendor_lib/rspec/core/pending.rb +110 -0
- data/vendor_lib/rspec/core/project_initializer.rb +88 -0
- data/vendor_lib/rspec/core/rake_task.rb +128 -0
- data/vendor_lib/rspec/core/reporter.rb +132 -0
- data/vendor_lib/rspec/core/ruby_project.rb +44 -0
- data/vendor_lib/rspec/core/runner.rb +97 -0
- data/vendor_lib/rspec/core/shared_context.rb +53 -0
- data/vendor_lib/rspec/core/shared_example_group.rb +146 -0
- data/vendor_lib/rspec/core/shared_example_group/collection.rb +27 -0
- data/vendor_lib/rspec/core/version.rb +7 -0
- data/vendor_lib/rspec/core/warnings.rb +22 -0
- data/vendor_lib/rspec/core/world.rb +131 -0
- data/vendor_lib/rspec/expectations.rb +75 -0
- data/vendor_lib/rspec/expectations/differ.rb +154 -0
- data/vendor_lib/rspec/expectations/errors.rb +9 -0
- data/vendor_lib/rspec/expectations/expectation_target.rb +87 -0
- data/vendor_lib/rspec/expectations/extensions.rb +1 -0
- data/vendor_lib/rspec/expectations/extensions/object.rb +29 -0
- data/vendor_lib/rspec/expectations/fail_with.rb +79 -0
- data/vendor_lib/rspec/expectations/handler.rb +68 -0
- data/vendor_lib/rspec/expectations/syntax.rb +182 -0
- data/vendor_lib/rspec/expectations/version.rb +8 -0
- data/vendor_lib/rspec/matchers.rb +633 -0
- data/vendor_lib/rspec/matchers/built_in.rb +39 -0
- data/vendor_lib/rspec/matchers/built_in/base_matcher.rb +68 -0
- data/vendor_lib/rspec/matchers/built_in/be.rb +213 -0
- data/vendor_lib/rspec/matchers/built_in/be_instance_of.rb +15 -0
- data/vendor_lib/rspec/matchers/built_in/be_kind_of.rb +11 -0
- data/vendor_lib/rspec/matchers/built_in/be_within.rb +55 -0
- data/vendor_lib/rspec/matchers/built_in/change.rb +141 -0
- data/vendor_lib/rspec/matchers/built_in/cover.rb +21 -0
- data/vendor_lib/rspec/matchers/built_in/eq.rb +22 -0
- data/vendor_lib/rspec/matchers/built_in/eql.rb +23 -0
- data/vendor_lib/rspec/matchers/built_in/equal.rb +48 -0
- data/vendor_lib/rspec/matchers/built_in/exist.rb +26 -0
- data/vendor_lib/rspec/matchers/built_in/has.rb +48 -0
- data/vendor_lib/rspec/matchers/built_in/include.rb +61 -0
- data/vendor_lib/rspec/matchers/built_in/match.rb +17 -0
- data/vendor_lib/rspec/matchers/built_in/match_array.rb +51 -0
- data/vendor_lib/rspec/matchers/built_in/raise_error.rb +154 -0
- data/vendor_lib/rspec/matchers/built_in/respond_to.rb +74 -0
- data/vendor_lib/rspec/matchers/built_in/satisfy.rb +30 -0
- data/vendor_lib/rspec/matchers/built_in/start_and_end_with.rb +48 -0
- data/vendor_lib/rspec/matchers/built_in/throw_symbol.rb +94 -0
- data/vendor_lib/rspec/matchers/built_in/yield.rb +297 -0
- data/vendor_lib/rspec/matchers/compatibility.rb +14 -0
- data/vendor_lib/rspec/matchers/configuration.rb +113 -0
- data/vendor_lib/rspec/matchers/dsl.rb +23 -0
- data/vendor_lib/rspec/matchers/generated_descriptions.rb +35 -0
- data/vendor_lib/rspec/matchers/matcher.rb +301 -0
- data/vendor_lib/rspec/matchers/method_missing.rb +12 -0
- data/vendor_lib/rspec/matchers/operator_matcher.rb +99 -0
- data/vendor_lib/rspec/matchers/pretty.rb +70 -0
- data/vendor_lib/rspec/matchers/test_unit_integration.rb +11 -0
- data/vendor_lib/rspec/mocks.rb +100 -0
- data/vendor_lib/rspec/mocks/any_instance/chain.rb +92 -0
- data/vendor_lib/rspec/mocks/any_instance/expectation_chain.rb +47 -0
- data/vendor_lib/rspec/mocks/any_instance/message_chains.rb +75 -0
- data/vendor_lib/rspec/mocks/any_instance/recorder.rb +200 -0
- data/vendor_lib/rspec/mocks/any_instance/stub_chain.rb +45 -0
- data/vendor_lib/rspec/mocks/any_instance/stub_chain_chain.rb +23 -0
- data/vendor_lib/rspec/mocks/argument_list_matcher.rb +104 -0
- data/vendor_lib/rspec/mocks/argument_matchers.rb +264 -0
- data/vendor_lib/rspec/mocks/arity_calculator.rb +66 -0
- data/vendor_lib/rspec/mocks/configuration.rb +111 -0
- data/vendor_lib/rspec/mocks/error_generator.rb +203 -0
- data/vendor_lib/rspec/mocks/errors.rb +12 -0
- data/vendor_lib/rspec/mocks/example_methods.rb +201 -0
- data/vendor_lib/rspec/mocks/extensions/marshal.rb +17 -0
- data/vendor_lib/rspec/mocks/framework.rb +36 -0
- data/vendor_lib/rspec/mocks/instance_method_stasher.rb +112 -0
- data/vendor_lib/rspec/mocks/matchers/have_received.rb +99 -0
- data/vendor_lib/rspec/mocks/matchers/receive.rb +112 -0
- data/vendor_lib/rspec/mocks/matchers/receive_messages.rb +72 -0
- data/vendor_lib/rspec/mocks/message_expectation.rb +643 -0
- data/vendor_lib/rspec/mocks/method_double.rb +209 -0
- data/vendor_lib/rspec/mocks/method_reference.rb +95 -0
- data/vendor_lib/rspec/mocks/mock.rb +7 -0
- data/vendor_lib/rspec/mocks/mutate_const.rb +406 -0
- data/vendor_lib/rspec/mocks/object_reference.rb +90 -0
- data/vendor_lib/rspec/mocks/order_group.rb +82 -0
- data/vendor_lib/rspec/mocks/proxy.rb +269 -0
- data/vendor_lib/rspec/mocks/proxy_for_nil.rb +37 -0
- data/vendor_lib/rspec/mocks/space.rb +95 -0
- data/vendor_lib/rspec/mocks/standalone.rb +3 -0
- data/vendor_lib/rspec/mocks/stub_chain.rb +51 -0
- data/vendor_lib/rspec/mocks/syntax.rb +374 -0
- data/vendor_lib/rspec/mocks/targets.rb +90 -0
- data/vendor_lib/rspec/mocks/test_double.rb +109 -0
- data/vendor_lib/rspec/mocks/verifying_double.rb +77 -0
- data/vendor_lib/rspec/mocks/verifying_message_expecation.rb +60 -0
- data/vendor_lib/rspec/mocks/verifying_proxy.rb +151 -0
- data/vendor_lib/rspec/mocks/version.rb +7 -0
- data/vendor_lib/rspec/support.rb +6 -0
- data/vendor_lib/rspec/support/caller_filter.rb +56 -0
- data/vendor_lib/rspec/support/spec.rb +14 -0
- data/vendor_lib/rspec/support/spec/deprecation_helpers.rb +29 -0
- data/vendor_lib/rspec/support/spec/in_sub_process.rb +40 -0
- data/vendor_lib/rspec/support/spec/stderr_splitter.rb +50 -0
- data/vendor_lib/rspec/support/version.rb +7 -0
- data/vendor_lib/rspec/support/warnings.rb +41 -0
- data/vendor_lib/rspec/version.rb +5 -0
- metadata +268 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2b3bffac0fd599819976d04e565530faeb4476b4
|
4
|
+
data.tar.gz: 0ced8be11b11b5beb051cb988aa6773e76258b62
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ef67bb1aec1bec9edac59b9529d5cd9f266e35edbe18282fb6609959cf4711535947d1138c2987f0d6237a9bdc4d7f18195fc1f60cb5eaea8c880d655da8038a
|
7
|
+
data.tar.gz: 00e6c97b347063e75c1106557852796d3442b2a85314e26ff50d8ebc182c41fe24fde41cf9e836bd46601b76e16a11c417d0ab458088472334dddcf05fa6d97c
|
data/.gitignore
ADDED
data/.gitmodules
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
[submodule "rspec"]
|
2
|
+
path = rspec
|
3
|
+
url = https://github.com/rspec/rspec.git
|
4
|
+
[submodule "rspec-support"]
|
5
|
+
path = rspec-support
|
6
|
+
url = https://github.com/rspec/rspec-support.git
|
7
|
+
[submodule "rspec-core"]
|
8
|
+
path = rspec-core
|
9
|
+
url = https://github.com/rspec/rspec-core.git
|
10
|
+
[submodule "rspec-mocks"]
|
11
|
+
path = rspec-mocks
|
12
|
+
url = https://github.com/rspec/rspec-mocks.git
|
13
|
+
[submodule "rspec-expectations"]
|
14
|
+
path = rspec-expectations
|
15
|
+
url = https://github.com/rspec/rspec-expectations.git
|
data/.travis.yml
ADDED
data/.yardopts
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
## 0.4.3 (2015-06-14)
|
2
|
+
|
3
|
+
* Allow the gem to be run under Opal 0.7 and 0.8
|
4
|
+
* Fix some threading issues
|
5
|
+
* Avoid some other calls to mutable-strings methods
|
6
|
+
|
7
|
+
## 0.4.2 (2015-03-28)
|
8
|
+
|
9
|
+
* Avoid phantomjs warning messages
|
10
|
+
|
11
|
+
## 0.4.1
|
12
|
+
|
13
|
+
* Remove predicate matcher fixes as Opal supports $1..$9 special gvars.
|
14
|
+
|
15
|
+
* Update Opal dependency for ~> 0.6.0.
|
16
|
+
|
17
|
+
* Remove double-escaping in inline x-strings (from Opal bug fix).
|
18
|
+
|
19
|
+
* Remove opal-sprockets dependency - build tools now part of opal.
|
20
|
+
|
21
|
+
* Replaced browser formatter to use html printer from rspec
|
22
|
+
|
23
|
+
* Add timeout support to asynchronous specs
|
24
|
+
|
25
|
+
## 0.2.1 November 24, 2013
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
# opal-rspec
|
2
|
+
|
3
|
+
[![Build Status](http://img.shields.io/travis/opal/opal-rspec/master.svg?style=flat)](http://travis-ci.org/opal/opal-rspec)
|
4
|
+
|
5
|
+
An attempt at a compatibility layer of rspec for opal.
|
6
|
+
|
7
|
+
[See the website for documentation](http://opalrb.org/docs/rspec/).
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
Add `opal-rspec` to your Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'opal-rspec'
|
15
|
+
```
|
16
|
+
|
17
|
+
### Run specs in phantomjs
|
18
|
+
|
19
|
+
To run specs, a rake task can be added which will load all spec files from
|
20
|
+
`spec/`:
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
require 'opal/rspec/rake_task'
|
24
|
+
Opal::RSpec::RakeTask.new(:default)
|
25
|
+
```
|
26
|
+
|
27
|
+
Then, to run your specs inside phantomjs, just run the rake task:
|
28
|
+
|
29
|
+
```
|
30
|
+
bundle exec rake
|
31
|
+
```
|
32
|
+
|
33
|
+
### Run specs in a browser
|
34
|
+
|
35
|
+
`opal-rspec` can use sprockets to build and serve specs over a simple rack
|
36
|
+
server. Add the following to a `config.ru` file:
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
require 'bundler'
|
40
|
+
Bundler.require
|
41
|
+
|
42
|
+
run Opal::Server.new { |s|
|
43
|
+
s.main = 'opal/rspec/sprockets_runner'
|
44
|
+
s.append_path 'spec'
|
45
|
+
s.debug = false
|
46
|
+
}
|
47
|
+
```
|
48
|
+
|
49
|
+
Then run the rack server `bundle exec rackup` and visit `http://localhost:9292`
|
50
|
+
in any web browser.
|
51
|
+
|
52
|
+
## Async examples
|
53
|
+
|
54
|
+
`opal-rspec` adds support for async specs to rspec. These specs are defined using
|
55
|
+
`#async` instead of `#it`:
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
describe MyClass do
|
59
|
+
# normal example
|
60
|
+
it 'does something' do
|
61
|
+
expect(:foo).to eq(:foo)
|
62
|
+
end
|
63
|
+
|
64
|
+
# async example
|
65
|
+
async 'does something else, too' do
|
66
|
+
# ...
|
67
|
+
end
|
68
|
+
end
|
69
|
+
```
|
70
|
+
|
71
|
+
This just marks the example as running async. To actually handle the async result,
|
72
|
+
you also need to use a `run_async` call inside some future handler:
|
73
|
+
|
74
|
+
```ruby
|
75
|
+
async 'HTTP requests should work' do
|
76
|
+
HTTP.get('/users/1.json') do |res|
|
77
|
+
run_async {
|
78
|
+
expect(res).to be_ok
|
79
|
+
}
|
80
|
+
end
|
81
|
+
end
|
82
|
+
```
|
83
|
+
|
84
|
+
The block passed to `run_async` informs the runner that this spec is finished
|
85
|
+
so it can move on. Any failures/expectations run inside this block will be run
|
86
|
+
in the context of the example.
|
87
|
+
|
88
|
+
## Contributing
|
89
|
+
|
90
|
+
Install required gems at required versions:
|
91
|
+
|
92
|
+
$ bundle install
|
93
|
+
|
94
|
+
opal-rspec uses a prebuilt version of rspec to fix the areas where
|
95
|
+
opal cannot handle certain features of rspec. To build that file,
|
96
|
+
which is needed to run specs, use:
|
97
|
+
|
98
|
+
$ bundle exec rake build
|
99
|
+
|
100
|
+
This should build `opal/opal/rspec/rspec.js` ready to use.
|
101
|
+
|
102
|
+
### Run on command line
|
103
|
+
|
104
|
+
A simple rake task should run the example specs in `spec/`:
|
105
|
+
|
106
|
+
$ bundle exec rake
|
107
|
+
|
108
|
+
### Run in the browser
|
109
|
+
|
110
|
+
Run attached rack app to handle building:
|
111
|
+
|
112
|
+
$ bundle exec rackup
|
113
|
+
|
114
|
+
Visit the page in any browser and view the console:
|
115
|
+
|
116
|
+
$ open http://localhost:9292
|
117
|
+
|
118
|
+
## Things to fix
|
119
|
+
|
120
|
+
`opal/opal-rspec/fixes.rb` contains a few bug fixes that need to be merged upstream
|
121
|
+
to opal itself. `app/rspec-builder.rb` is used to precompile rspec ready to be used
|
122
|
+
in `opal-rspec`. All requires from `core.rb` have been inlined as opal cannot require
|
123
|
+
dynamically at runtime.
|
124
|
+
|
125
|
+
## License
|
126
|
+
|
127
|
+
(The MIT License)
|
128
|
+
|
129
|
+
Copyright (C) 2013 by Adam Beynon
|
130
|
+
|
131
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
132
|
+
of this software and associated documentation files (the "Software"), to deal
|
133
|
+
in the Software without restriction, including without limitation the rights
|
134
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
135
|
+
copies of the Software, and to permit persons to whom the Software is
|
136
|
+
furnished to do so, subject to the following conditions:
|
137
|
+
|
138
|
+
The above copyright notice and this permission notice shall be included in
|
139
|
+
all copies or substantial portions of the Software.
|
140
|
+
|
141
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
142
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
143
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
144
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
145
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
146
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
147
|
+
THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler.require
|
3
|
+
|
4
|
+
Bundler::GemHelper.install_tasks
|
5
|
+
|
6
|
+
require 'opal/rspec/rake_task'
|
7
|
+
Opal::RSpec::RakeTask.new(:default)
|
8
|
+
|
9
|
+
|
10
|
+
require 'fileutils'
|
11
|
+
desc "Copy RSpec sources"
|
12
|
+
task :copy_rspec do
|
13
|
+
gems = %w(rspec rspec-core rspec-expectations rspec-mocks rspec-support)
|
14
|
+
|
15
|
+
gems.each do |gem|
|
16
|
+
spec = Gem::Specification.find_by_name gem
|
17
|
+
lib = File.join spec.gem_dir, 'lib'
|
18
|
+
|
19
|
+
Dir["#{lib}/**/*.rb"].each do |file|
|
20
|
+
out = file.sub(/^#{lib}\//, 'opal/')
|
21
|
+
|
22
|
+
FileUtils.mkdir_p File.dirname(out)
|
23
|
+
FileUtils.cp file, out
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/config.ru
ADDED
data/example/Gemfile
ADDED
data/example/README.md
ADDED
data/example/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'user'
|
2
|
+
|
3
|
+
describe User do
|
4
|
+
it '#initialize accepts a name' do
|
5
|
+
expect(User.new('Jim').name).to eq('Jim')
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'is an admin if name is Bob' do
|
9
|
+
expect(User.new('Bob')).to be_admin
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'is not an admin if name is not Bob' do
|
13
|
+
expect(User.new('Jim')).to_not be_admin
|
14
|
+
end
|
15
|
+
end
|
data/lib/opal-rspec.rb
ADDED
data/lib/opal/rspec.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'opal'
|
2
|
+
require 'opal/rspec/version'
|
3
|
+
|
4
|
+
# Just register our opal code path with opal build tools
|
5
|
+
Opal.append_path File.expand_path('../../../opal', __FILE__)
|
6
|
+
Opal.append_path File.expand_path('../../../vendor_lib', __FILE__)
|
7
|
+
|
8
|
+
Opal::Processor.dynamic_require_severity = :ignore
|
9
|
+
|
10
|
+
Opal::Processor.stub_file "rspec/matchers/built_in/have"
|
11
|
+
Opal::Processor.stub_file "diff/lcs"
|
12
|
+
Opal::Processor.stub_file "diff/lcs/hunk"
|
13
|
+
Opal::Processor.stub_file "fileutils"
|
14
|
+
Opal::Processor.stub_file "test/unit/assertions"
|
15
|
+
Opal::Processor.stub_file "coderay"
|
16
|
+
Opal::Processor.stub_file "optparse"
|
17
|
+
Opal::Processor.stub_file "shellwords"
|
18
|
+
Opal::Processor.stub_file "socket"
|
19
|
+
Opal::Processor.stub_file "uri"
|
20
|
+
Opal::Processor.stub_file "drb/drb"
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'opal/rspec'
|
2
|
+
|
3
|
+
module Opal
|
4
|
+
module RSpec
|
5
|
+
class RakeTask
|
6
|
+
include Rake::DSL if defined? Rake::DSL
|
7
|
+
|
8
|
+
RUNNER = File.expand_path('../../../../vendor/spec_runner.js', __FILE__)
|
9
|
+
PORT = 9999
|
10
|
+
URL = "http://localhost:9999/"
|
11
|
+
|
12
|
+
def initialize(name = 'opal:rspec', spec_app = false, &block)
|
13
|
+
desc "Run opal specs in phantomjs"
|
14
|
+
task name do
|
15
|
+
require 'rack'
|
16
|
+
require 'webrick'
|
17
|
+
|
18
|
+
apps = []
|
19
|
+
apps << app = Opal::Server.new { |s|
|
20
|
+
s.main = 'opal/rspec/sprockets_runner'
|
21
|
+
s.append_path 'spec'
|
22
|
+
s.debug = false
|
23
|
+
|
24
|
+
block.call s if block_given?
|
25
|
+
}
|
26
|
+
|
27
|
+
apps << Object.const_get(spec_app.to_s) if spec_app
|
28
|
+
|
29
|
+
server = Thread.new do
|
30
|
+
Thread.current.abort_on_exception = true
|
31
|
+
Rack::Server.start(
|
32
|
+
:app => Rack::Cascade.new([app, spec_app]),
|
33
|
+
:Port => PORT,
|
34
|
+
:AccessLog => [],
|
35
|
+
:Logger => WEBrick::Log.new("/dev/null"),
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
if `phantomjs -v`.strip.to_i >= 2
|
40
|
+
warn <<-WARN.gsub(/^ /,'')
|
41
|
+
Only PhantomJS v1 is currently supported,
|
42
|
+
if you're using homebrew on OSX you can switch version with:
|
43
|
+
|
44
|
+
brew switch phantomjs 1.9.8
|
45
|
+
|
46
|
+
WARN
|
47
|
+
exit 1
|
48
|
+
end
|
49
|
+
|
50
|
+
begin
|
51
|
+
system %Q{phantomjs #{RUNNER} "#{URL}"}
|
52
|
+
success = $?.success?
|
53
|
+
|
54
|
+
exit 1 unless success
|
55
|
+
ensure
|
56
|
+
server.kill
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
data/opal-rspec.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/opal/rspec/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'opal-rspec-cj'
|
6
|
+
s.version = Opal::RSpec::VERSION
|
7
|
+
s.author = ['Adam Beynon', 'CJ Lazell']
|
8
|
+
s.email = ['adam.beynon@gmail.com', 'cjlazell@gmail.com']
|
9
|
+
s.homepage = 'http://opalrb.org'
|
10
|
+
s.summary = 'RSpec for Opal'
|
11
|
+
s.description = 'Opal compatible rspec library'
|
12
|
+
|
13
|
+
s.files = `git ls-files`.split("\n")
|
14
|
+
|
15
|
+
s.require_paths = ['lib']
|
16
|
+
|
17
|
+
s.add_dependency 'opal', ['>= 0.7.0', '< 0.9']
|
18
|
+
s.add_development_dependency 'rake'
|
19
|
+
s.add_development_dependency 'yard'
|
20
|
+
end
|
21
|
+
|