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
# In request/integration/acceptance specs, the more examples you have, the slower the spec. | |
# This obviously applies to any other kind of spec, but the performance trade off | |
# is not worth it for high level tests - it can potentially cost you seconds. | |
# Hard to read/process but fast | |
describe 'viewing a user profile' do | |
before { login } | |
it 'displays the name, birthdate, active, address, phone number, last login' | |
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
ruby-1.9.3-preview1 :070 > a = [Array, String, Class.new(String)] | |
=> [Array, String, #<Class:0x007fcab38332b0>] | |
ruby-1.9.3-preview1 :071 > a.shuffle | |
=> [#<Class:0x007fcab38332b0>, String, Array] | |
ruby-1.9.3-preview1 :072 > a.shuffle(random: Random.new(1)) | |
=> [Array, #<Class:0x007fcab38332b0>, String] | |
ruby-1.9.3-preview1 :073 > a.shuffle(random: Random.new(1)) | |
=> [Array, #<Class:0x007fcab38332b0>, String] | |
ruby-1.9.3-preview1 :074 > a.shuffle(random: Random.new(2)) | |
=> [#<Class:0x007fcab38332b0>, Array, String] |
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
Search | |
User enters a non-searchable value | |
Search for "***" on the search page | |
"Seriously?" is shown in the message section | |
No search log is created | |
Search service is down # This can function as a step too, if one is found. | |
"Search unavailable, go away" is show in the message section | |
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
➜ Downloads gcc -pthread threading1.c | |
threading1.c:14: error: conflicting types for ‘wait’ | |
/usr/include/sys/wait.h:255: error: previous declaration of ‘wait’ was here | |
threading1.c: In function ‘threadFunction’: | |
threading1.c:91: warning: format ‘%i’ expects type ‘int’, but argument 2 has type ‘pthread_t’ | |
threading1.c:91: warning: format ‘%i’ expects type ‘int’, but argument 2 has type ‘pthread_t’ | |
threading1.c:98: warning: format ‘%i’ expects type ‘int’, but argument 2 has type ‘pthread_t’ | |
threading1.c:98: warning: format ‘%i’ expects type ‘int’, but argument 2 has type ‘pthread_t’ | |
threading1.c: At top level: | |
threading1.c:107: error: conflicting types for ‘wait’ |
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
class MyClass | |
def self.all_methods | |
all_singleton_methods + all_instance_methods | |
end | |
def self.all_singleton_methods | |
singleton_methods | |
end | |
def self.all_instance_methods |
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
def stub_module(full_name) | |
full_name.to_s.split(/::/).inject(Object) do |context, name| | |
begin | |
context.const_get(name) | |
rescue NameError | |
context.const_set(name, Module.new) | |
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
module ModuleStubbing | |
def stubbed_modules | |
@stubbed_modules ||= [] | |
end | |
def stub_module(full_name) | |
most_shallow_stubbed_module = nil | |
full_name.to_s.split(/::/).inject(Object) do |context, name| | |
begin |
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
class PostsController < ApplicationController | |
before_filter :post, only: :create # this feels like it's "posting", not setting a post | |
helper_method :post | |
def create | |
post.save | |
end | |
def post | |
@post ||= Post.new(params.fetch(:post) {{}}) |
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
class PostCreationContext | |
def initialize(post) | |
@post = post | |
@post.extend PostNotifier | |
@post.extend PostIndexer | |
@post.extend PostCacher | |
end | |
def execute | |
@post.save |
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 change: | |
https://github.com/rubinius/rubinius/commit/15f8bdf440236481c5fcb953234b1e173edf9e2e | |
Breaks this code: | |
https://gist.github.com/1065789 | |
Backtrace: | |
Kernel(NilClass)#each (method_missing) at kernel/delta/kernel.rb:81 | |
Rubinius::AST::Container(Rubinius::AST::Script)#container_bytecode at \ | |
/Users/justinko/.rvm/rubies/rbx-head/runtime/18/compiler/ast/definitions.rbc:944 |