-
-
Notifications
You must be signed in to change notification settings - Fork 330
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- v1.8.3.rc1
- v1.8.2
- v1.8.1
- v1.8.0
- v1.8.0.beta1
- v1.8.0.alpha1
- v1.7.4
- v1.7.3
- v1.7.2
- v1.7.1
- v1.7.0
- v1.7.0.rc1
- v1.6.1
- v1.6.0
- v1.6.0.rc1
- v1.6.0.alpha1
- v1.5.1
- v1.5.0
- v1.5.0.rc1
- v1.4.1
- v1.4.0
- v1.4.0.alpha1
- v1.3.2
- v1.3.1
- v1.3.0
- v1.3.0.rc1
- v1.3.0.alpha1
- v1.2.0
- v1.2.0.beta1
- v1.1.1
- v1.1.1.rc1
- v1.1.0
- v1.1.0.rc1
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- v1.0.0.beta1
- v0.11.4
- v0.11.3
- v0.11.2
- v0.11.1
- v0.11.1.pre
- v0.11.0
- v0.11.0.rc1
- v0.10.6
- v0.10.6.beta
- v0.10.5
- v0.10.4
- v0.10.3
- v0.10.2
- v0.10.1
- v0.10.0
- v0.10.0.rc2
- v0.10.0.rc1
- v0.10.0.beta5
- v0.10.0.beta4
- v0.10.0.beta3
- v0.10.0.beta2
- v0.10.0.beta1
- v0.9.4
- v0.9.3
- v0.9.2
- v0.9.1
- v0.9.0
- v0.9.0.rc1
- v0.9.0.beta2
- v0.9.0.beta1
- v0.8.1
- v0.8.1.rc1
- v0.8.0
- v0.8.0.rc3
- v0.8.0.rc2
- v0.8.0.rc1
- v0.8.0.beta1
- v0.7.2
- v0.7.1
- v0.7.0
- v0.7.0.rc1
- v0.7.0.beta3
- v0.7.0.beta2
- v0.7.0.beta1
- v0.6.3
- v0.6.2
- v0.6.1
- v0.6.0
- v0.5.5
- v0.5.4
- v0.5.3
- v0.5.2
- v0.5.1
- v0.5.0
- v0.0.1-alpha.1
- npm-0.0.1-alpha.8
- npm-0.0.1-alpha.7
- npm-0.0.1-alpha.6
- npm-0.0.1-alpha.5
- npm-0.0.1-alpha.4
- npm-0.0.1-alpha.3
- lerna-0.0.1-alpha.2
1 parent
055b851
commit a466f8b
Showing
4 changed files
with
211 additions
and
209 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
spec/ospec/mock_install_method_patch.rb → spec/ospec/mspec_fixes.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
class OSpecFilter | ||
def self.main | ||
@main ||= self.new | ||
end | ||
|
||
def initialize | ||
@filters = Set.new | ||
end | ||
|
||
def register | ||
MSpec.register :exclude, self | ||
end | ||
|
||
def ===(description) | ||
@filters.include? description | ||
end | ||
|
||
def register_filters(description, block) | ||
instance_eval(&block) | ||
end | ||
|
||
def fails(description) | ||
@filters << description | ||
end | ||
end | ||
|
||
class Object | ||
def opal_filter(description, &block) | ||
OSpecFilter.main.register_filters(description, block) | ||
end | ||
end | ||
|
||
class BrowserFormatter | ||
def initialize(out=nil) | ||
@exception = @failure = false | ||
@exceptions = [] | ||
@count = 0 | ||
@examples = 0 | ||
|
||
@current_state = nil | ||
end | ||
|
||
def register | ||
MSpec.register :exception, self | ||
MSpec.register :before, self | ||
MSpec.register :after, self | ||
MSpec.register :start, self | ||
MSpec.register :finish, self | ||
MSpec.register :abort, self | ||
MSpec.register :enter, self | ||
end | ||
|
||
def green(str) | ||
`console.info(str)` | ||
end | ||
|
||
def red(str) | ||
`console.error(str)` | ||
end | ||
|
||
def log(str) | ||
`console.log(str)` | ||
end | ||
|
||
def exception? | ||
@exception | ||
end | ||
|
||
def failure? | ||
@failure | ||
end | ||
|
||
def enter(describe); end | ||
|
||
def before(state=nil) | ||
@current_state = nil | ||
@failure = @exception = false | ||
end | ||
|
||
def exception(exception) | ||
@count += 1 | ||
@failure = @exception ? @failure && exception.failure? : exception.failure? | ||
@exception = true | ||
@exceptions << exception | ||
end | ||
|
||
def after(state = nil) | ||
@current_state = nil | ||
@examples += 1 | ||
end | ||
|
||
def start | ||
@start_time = Time.now.to_f | ||
end | ||
|
||
def finish | ||
time = Time.now.to_f - @start_time | ||
|
||
if @exceptions.empty? | ||
log "\nFinished" | ||
green "#{@examples} examples, #{@count} failures (time taken: #{time})" | ||
|
||
finish_with_code 0 | ||
else | ||
log "\nFailures:" | ||
|
||
@exceptions.each_with_index do |exception, idx| | ||
log "\n #{idx + 1}. #{exception.description}" | ||
red "\n #{exception.message}" | ||
end | ||
|
||
log "\nFinished" | ||
red "#{@examples} examples, #{@count} failures (time taken: #{time})" | ||
|
||
finish_with_code(1) | ||
end | ||
end | ||
|
||
def finish_with_code(code) | ||
`window.OPAL_SPEC_CODE = code;` | ||
end | ||
end | ||
|
||
class PhantomFormatter < BrowserFormatter | ||
def green(str) | ||
`console.log('\\033[32m' + str + '\\033[0m')` | ||
end | ||
|
||
def red(str) | ||
`console.log('\\033[31m' + str + '\\033[0m')` | ||
end | ||
|
||
def log(str) | ||
`console.log(str)` | ||
end | ||
end | ||
|
||
module MSpec | ||
def self.opal_runner | ||
@env = Object.new | ||
@env.extend MSpec | ||
end | ||
end | ||
|
||
class OSpecRunner | ||
def self.main(formatter_class = BrowserFormatter) | ||
@main ||= self.new formatter_class | ||
end | ||
|
||
def initialize(formatter_class) | ||
@formatter_class = formatter_class | ||
register | ||
run | ||
end | ||
|
||
def register | ||
formatter = @formatter_class.new | ||
formatter.register | ||
|
||
OSpecFilter.main.register | ||
end | ||
|
||
def run | ||
MSpec.opal_runner | ||
end | ||
|
||
def will_start | ||
MSpec.actions :start | ||
end | ||
|
||
def did_finish | ||
MSpec.actions :finish | ||
end | ||
end | ||
|
||
module OutputSilencer | ||
def silence_stdout | ||
original_stdout = $stdout | ||
new_stdout = Object.new | ||
`#{new_stdout}.$puts = function(){}` | ||
begin | ||
$stdout = new_stdout | ||
yield | ||
ensure | ||
$stdout = original_stdout | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters