Skip to content

Instantly share code, notes, and snippets.

@RobinClowers
RobinClowers / gist:1983757
Created March 6, 2012 05:19
Sinon js extensions
// regular jasmine api
this.server.respondWith("GET", "/some/article/comments.json", [
200, {
"Content-Type": "application/json"
}, '[{ "id": 12, "comment": "Hey there" }]'
]);
// extension api
this.server.on("GET", "/some/article/comments.json").respond(200, {
id: 121,
@RobinClowers
RobinClowers / gist:2018620
Created March 11, 2012 23:19
Rspec mock AAA extension
require 'rspec'
# is it really this simple?
RSpec::Matchers.define :have_received do |method_name, *args|
match do |actual|
actual.received_message?(method_name, *args, &block)
end
end
describe 'have received matcher' do
source 'https://rubygems.org'
ruby '2.1.1'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.1'
# Use postgres as the database for Active Record
gem 'pg'
@RobinClowers
RobinClowers / output
Created October 15, 2014 02:20
Rmagick bus error
/srv/photo_album/shared/bundle/ruby/2.1.0/gems/rmagick-2.13.2/lib/RMagick.rb:1635: [BUG] Bus Error at 0x007fcad037d004
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0032 p:---- s:0115 e:000114 CFUNC :read
c:0031 p:0019 s:0111 e:000110 BLOCK /srv/photo_album/shared/bundle/ruby/2.1.0/gems/rmagick-2.13.2/lib/RMagick.rb:1635 [FINISH]
c:0030 p:---- s:0108 e:000107 CFUNC :each
c:0029 p:0021 s:0105 e:000104 METHOD /srv/photo_album/shared/bundle/ruby/2.1.0/gems/rmagick-2.13.2/lib/RMagick.rb:1634 [FINISH]
c:0028 p:---- s:0100 e:000099 CFUNC :new
c:0027 p:0029 s:0096 e:000095 BLOCK /srv/photo_album/releases/20141015014950/lib/album_processor.rb:79 [FINISH]
This file has been truncated, but you can view the full file.
Finished "EnableLogging()" with response "Success()"
Wrote response true ""
Received "SetTimeout(-1)"
Started "SetTimeout(-1)"
Finished "SetTimeout(-1)" with response "Success()"
Wrote response true ""
Received "AllowUrl(*)"
Started "AllowUrl(*)"
Finished "AllowUrl(*)" with response "Success()"
Wrote response true ""