-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mihai Târnovan
committed
Jun 1, 2012
1 parent
849447c
commit 37b9149
Showing
9 changed files
with
115 additions
and
1 deletion.
There are no files selected for viewing
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,4 @@ | ||
source 'https://rubygems.org' | ||
|
||
# Specify your gem's dependencies in sinon-rails.gemspec | ||
gemspec |
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,22 @@ | ||
Copyright (c) 2012 Mihai Tarnovan | ||
|
||
MIT License | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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 |
---|---|---|
@@ -1,4 +1,12 @@ | ||
jasmine-sinon-rails | ||
=================== | ||
|
||
jasmine-sinon.js matchers via Rails 3.1+ asset pipeline | ||
<<<<<<< HEAD | ||
jasmine-sinon.js matchers via Rails 3.1+ asset pipeline | ||
======= | ||
jasmine-sinon matchers via Rails 3.1+ asset pipeline | ||
|
||
See https://github.com/froots/jasmine-sinon | ||
|
||
In Gemfile... you know the drill. | ||
>>>>>>> * initial commit |
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,2 @@ | ||
#!/usr/bin/env rake | ||
require "bundler/gem_tasks" |
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,16 @@ | ||
$:.push File.expand_path("../lib", __FILE__) | ||
require File.expand_path('../lib/jasmine-sinon-rails/version', __FILE__) | ||
|
||
Gem::Specification.new do |gem| | ||
gem.authors = ["Mihai Tarnovan"] | ||
gem.email = ["mihai.tarnovan@cubus.ro"] | ||
gem.summary = %q{jasmine-sinon.js matchers via Rails 3.1+ asset pipeline} | ||
gem.homepage = "https://github.com/mtarnovan/jasmine-sinon-rails" | ||
|
||
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } | ||
gem.files = `git ls-files`.split("\n") | ||
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") | ||
gem.name = "jasmine-sinon-rails" | ||
gem.require_paths = ["lib"] | ||
gem.version = JasmineSinon::Rails::VERSION | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Sinon | ||
module Rails | ||
class Engine < ::Rails::Engine | ||
# making class enables assets pipeline | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module Sinon | ||
module Rails | ||
VERSION = "1.3.2.1" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require "jasmine-sinon-rails/version" | ||
|
||
module JasmineSinon | ||
module Rails | ||
require 'jasmine-sinon-rails/engine' if defined?(Rails) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
(function(global) { | ||
|
||
var spyMatchers = "called calledOnce calledTwice calledThrice calledBefore calledAfter calledOn alwaysCalledOn calledWith alwaysCalledWith calledWithExactly alwaysCalledWithExactly".split(" "), | ||
i = spyMatchers.length, | ||
spyMatcherHash = {}, | ||
unusualMatchers = { | ||
"returned": "toHaveReturned", | ||
"alwaysReturned": "toHaveAlwaysReturned", | ||
"threw": "toHaveThrown", | ||
"alwaysThrew": "toHaveAlwaysThrown" | ||
}, | ||
|
||
getMatcherFunction = function(sinonName) { | ||
return function() { | ||
var sinonProperty = this.actual[sinonName]; | ||
return (typeof sinonProperty === 'function') ? sinonProperty.apply(this.actual, arguments) : sinonProperty; | ||
}; | ||
}; | ||
|
||
while(i--) { | ||
var sinonName = spyMatchers[i], | ||
matcherName = "toHaveBeen" + sinonName.charAt(0).toUpperCase() + sinonName.slice(1); | ||
|
||
spyMatcherHash[matcherName] = getMatcherFunction(sinonName); | ||
}; | ||
|
||
for (var j in unusualMatchers) { | ||
spyMatcherHash[unusualMatchers[j]] = getMatcherFunction(j); | ||
} | ||
|
||
global.sinonJasmine = { | ||
getMatchers: function() { | ||
return spyMatcherHash; | ||
} | ||
}; | ||
|
||
})(window); | ||
|
||
beforeEach(function() { | ||
|
||
this.addMatchers(sinonJasmine.getMatchers()); | ||
|
||
}); |