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
module CoolMixin | |
extend ActiveSupport::Concern | |
included do | |
before(:each) do | |
# Whatever | |
end | |
after(:all) do | |
# Whatever |
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 'spec_helper' | |
describe Api::V1_2::TokensController do | |
def parsed_response(response) | |
JSON.parse(response.body) | |
end | |
describe "POST create" do | |
let(:params) { {} } |
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 Array do | |
describe "the return value" do | |
subject do | |
subject.size # This obviously causes infinite recursion :-) | |
end | |
end | |
end | |
describe Array do | |
subject(:array) { Array.new } |
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 'openssl' | |
class UserData #< OpenSSL::X509::Name | |
def to_a | |
[0,1,2] | |
end | |
alias _dump_data to_a | |
def _load_data entries | |
entries.each do |entry| |
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 MyClass do | |
let(:size) { 10 } # An uninteresting size | |
let(:color) { "red" } | |
subject(:my_class) { MyClass.new(size, color) } | |
context "invalid sizes" do | |
context "negative sizes" do | |
let(:size) { -1 } |
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 Logwriter | |
SEVERITIES = [:info, :warning, :error, :critical] | |
# I wouldn't try to unit test this; integration test instead. It's | |
# also short enough I might just claim "it works". | |
def self.for_file(filename) | |
new(File.new(filename)) | |
end | |
def initialize(io) | |
@io = io |
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 ContestEntry | |
end | |
class ContestEntriesController | |
def create(params) | |
@contest_entry = ContestEntry.new(params[:contest_entry]) | |
@contest_entry.save | |
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
--- $LOAD_PATH: | |
/opt/wlp/1.0.1.cl0120121004_1949/wlp/usr/servers/staging/apps/cxo/WEB-INF/lib | |
/opt/wlp/1.0.1.cl0120121004_1949/wlp/usr/servers/staging/apps/cxo/WEB-INF/vendor | |
lib | |
/opt/wlp/1.0.1.cl0120121004_1949/wlp/usr/servers/staging/apps/cxo/WEB-INF/app/assets | |
/opt/wlp/1.0.1.cl0120121004_1949/wlp/usr/servers/staging/apps/cxo/WEB-INF/app/controllers | |
/opt/wlp/1.0.1.cl0120121004_1949/wlp/usr/servers/staging/apps/cxo/WEB-INF/app/helpers | |
/opt/wlp/1.0.1.cl0120121004_1949/wlp/usr/servers/staging/apps/cxo/WEB-INF/app/mailers | |
/opt/wlp/1.0.1.cl0120121004_1949/wlp/usr/servers/staging/apps/cxo/WEB-INF/app/models | |
/opt/wlp/1.0.1.cl0120121004_1949/wlp/usr/servers/staging/apps/cxo/WEB-INF/app/widgets |
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 Alpha | |
attr_reader :things | |
def initialize | |
@things = [] | |
freeze | |
end | |
end | |
a = Alpha.new |
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 EasyAccess | |
include classpath.to.TrustStrategy | |
def isTrusted(chain, authType) | |
true | |
end | |
end |