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 Spec | |
module Example | |
class ExampleGroupMethods | |
def run_examples(success, instance_variables, examples, run_options) | |
return [success, instance_variables] unless success | |
after_all_instance_variables = instance_variables | |
examples.each do |example| | |
example_group_instance = new(example, &example_implementations[example]) |
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 LRUCache | |
def initialize(max_size) | |
@max_size = max_size | |
end | |
def put(name, value) | |
queue << name unless queue.include?(name) | |
data[name] = value | |
data[queue.shift] = nil if queue.size > @max_size | |
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 RR | |
module DoubleDefinitions | |
class DoubleDefinition | |
def stub_chain(*args, &block) | |
eval( | |
args.flatten.inject('self') do |obj, name| | |
"#{obj}.stub!.#{name}" | |
end + ( block_given? ? ' { block.call }' : '' ) | |
) | |
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 RR::Adapters::RRMethods | |
def has_keys(*expected_keys) | |
RR::WildcardMatchers::HasKeys.new(expected_keys) | |
end | |
end | |
module RR::WildcardMatchers | |
class HasKeys | |
def initialize(keys) | |
@keys = keys.flatten |
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 RR::Adapters::RRMethods | |
def lazy(expected) | |
RR::WildcardMatchers::LazyMatcher.new(expected) | |
end | |
end | |
module RR::WildcardMatchers | |
class LazyMatcher | |
def initialize(value) | |
@value = value |
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
describe MyController, '#index' do | |
include PureControllerTestHelper | |
let(:user) { MyModel.make_unsaved } | |
before do | |
mock(MyModel).find { user } | |
end | |
it 'should assign @user' |
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
if [ $rvm_ruby_home ] ; then | |
alias gem='gem --config-file ~/.gemrc_for_rvm' | |
echo `type gem` | |
else | |
[ `type gem | awk '{print $4}'` = 'alias' ] && unalias gem | |
fi |
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
[auto-props] | |
### The format of the entries is: | |
### file-name-pattern = propname[=value][;propname[=value]...] | |
### The file-name-pattern can contain wildcards (such as '*' and | |
### '?'). All entries which match (case-insensitively) will be | |
### applied to the file. Note that auto-props functionality | |
### must be enabled, which is typically done by setting the | |
### 'enable-auto-props' option. | |
# *.c = svn:eol-style=native | |
# *.cpp = svn:eol-style=native |
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
require 'ruby_gntp' | |
def your_app | |
#TODO: | |
end | |
def your_host | |
#TODO: | |
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
describe_jsonapi 'GET /users/:id' do | |
let(:id) { 1 } | |
context 'when user exists' do | |
before(:all) do | |
User.make(:id => id) | |
Article.make(:user_id => id, :article_id => 1) | |
end | |
after(:all) { DatabaseCleaner.clean } |
OlderNewer