This file contains hidden or 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
| it "receive_message_chain allows inline return values" do | |
| object = double('hi') | |
| allow(object).to receive_message_chain(:msg1, :msg2 => :return_value) | |
| expect { | |
| object.msg1("nonsense", :value).msg2("another", :nonsense, 3.0, "value") | |
| }.not_to raise_error | |
| end |
This file contains hidden or 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
| diff --git a/lib/rspec/mocks/message_chain.rb b/lib/rspec/mocks/message_chain.rb | |
| index 97f2762..3445364 100644 | |
| --- a/lib/rspec/mocks/message_chain.rb | |
| +++ b/lib/rspec/mocks/message_chain.rb | |
| @@ -44,7 +44,7 @@ module RSpec | |
| hash = chain.pop | |
| hash.each do |k,v| | |
| chain << k | |
| - blk = lambda { v } | |
| + blk = lambda {|*args| v } |
This file contains hidden or 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
| describe "a blank category" do | |
| let(:subject) { Category.new } | |
| it { should have(1).error_on(:title) } | |
| .... | |
| end | |
| # rspec 3 | |
| describe "a blank category" do | |
| let(:subject) { Category.new } | |
| specify { expect(subject.errors_on(:title)).to be_present } |
This file contains hidden or 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
| require 'mysql2' | |
| require 'fast_stack' | |
| client = Mysql2::Client.new(:host => "localhost", :username => "root") | |
| query = "SELECT * FROM information_schema.COLUMNS LIMIT 58" | |
| # '58' is something of a magic number for this query. Any less, and the bug doesn't show up. At 58 or greater, I get: | |
| # "Lost connection to MySQL server during query (Mysql2::Error)" | |
| # The bug goes away if you comment out the FastStack.profile{} line. |
This file contains hidden or 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
| @interface MyAudioPlayer() { | |
| AVAudioPlayer* currentPlayer; | |
| } | |
| @end | |
| @implementation MyAudioPlayer | |
| +(instance_type)sharedPlayer { | |
| static MyAudioPlayer* sharedPlayer; | |
| static dispatch_once_t onceToken; |
This file contains hidden or 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
| 2013-11-01 12:58:14.004 Audioboo[174:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil' | |
| #0 0x37c9d688 in objc_exception_throw () | |
| #1 0x2d800d40 in -[__NSArrayM insertObject:atIndex:] () | |
| #2 0x302e8ace in __46-[UITableView _updateWithItems:updateSupport:]_block_invoke687 () | |
| #3 0x3006d2ac in +[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] () | |
| #4 0x3008416c in +[UIView(UIViewAnimationWithBlocks) animateWithDuration:delay:options:animations:completion:] () | |
| #5 0x3023311c in -[UITableView _updateWithItems:updateSupport:] () | |
| #6 0x3020ad8a in -[UITableView _endCellAnimationsWithContext:] () | |
| #7 0x302698ee in -[UITableView insertRowsAtIndexPaths:withRowAnimation:] () |
This file contains hidden or 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
| #6 0x00165802 in -[ABBoardsViewController tableView:cellForRowAtIndexPath:] at /Users/jon/Developer/iphone/Classes/ABBoardsViewController.m:95 | |
| #7 0x33a70314 in -[UITableView _createPreparedCellForGlobalRow:withIndexPath:] () | |
| #8 0x33a186cc in -[UITableView _updateVisibleCellsNow:] () | |
| #9 0x33a17ef0 in -[UITableView layoutSubviews] () | |
| #10 0x3393e352 in -[UIView(CALayerDelegate) layoutSublayersOfLayer:] () | |
| #11 0x335c4942 in -[CALayer layoutSublayers] () | |
| #12 0x335c0166 in CA::Layer::layout_if_needed(CA::Transaction*) () | |
| #13 0x335bfff8 in CA::Layer::layout_and_display_if_needed(CA::Transaction*) () | |
| #14 0x335bfa0c in CA::Context::commit_transaction(CA::Transaction*) () | |
| #15 0x335bf81e in CA::Transaction::commit() () |
This file contains hidden or 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
| @protocol FooDelegate; | |
| @interface Foo : NSObject | |
| @property id<FooDelegate> delegate; | |
| @end | |
| @protocol FooDelegate | |
| -(void)foo:(Foo*)x didBar:(NSString*)bar; | |
| @end |
This file contains hidden or 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
| class RecurringWorker | |
| def perform | |
| next_runtime = Time.now+10.minutes | |
| do_something | |
| Delayed::Job.enqueue RecurringWorker.new, :run_at => next_runtime | |
| end | |
| end |
This file contains hidden or 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
| require 'rack/handler/webrick' | |
| require 'selenium-webdriver' | |
| require 'rack' | |
| class Selenium::WebDriver::Chrome::Bridge | |
| def extract_service_args(args) | |
| ["--log-path=chromedriver.log", "--verbose"] | |
| end | |
| end |