source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
eldr-rb/eldr
https://github.com/eldr-rb/eldr
examples/inheritance.ru
Ruby
mit
99
master
409
class SimpleMiddleware def initialize(app) @app = app end def call(env) env['eldr.simple_counter'] ||= 0 env['eldr.simple_counter'] += 1 @app.call(env) end end class TestInheritanceApp < Eldr::App use SimpleCounterMiddleware set :bob, 'what about him?' end class InheritedApp < TestInherit...
github
eldr-rb/eldr
https://github.com/eldr-rb/eldr
examples/rendering_templates.ru
Ruby
mit
99
master
781
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'eldr' require 'tilt' require 'slim' module RenderingResponses class NotFound < StandardError def call(env) Rack::Response.new message, 404 end end end module RenderingHelpers def render(path, resp_code=200) Rack::Response.new ...
github
eldr-rb/eldr
https://github.com/eldr-rb/eldr
examples/multiple_apps.ru
Ruby
mit
99
master
475
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'eldr' class HelloWorldExample < Eldr::App get '/' do Rack::Response.new "Hello World EXAMPLE!" end end class CatsExample < Eldr::App get '/' do Rack::Response.new "Hello Cats!" end end class DogsExample < Eldr::App get '/', proc { ...
github
eldr-rb/eldr
https://github.com/eldr-rb/eldr
examples/custom_response.ru
Ruby
mit
99
master
454
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'eldr' class Response attr_accessor :status, :headers, :body def initialize(body, status=200, headers={}) @body, @status, @headers = body, status, headers end def to_a [@status, @headers, [@body]] end alias_method :to_ary, :to_a e...
github
shuber/proxy
https://github.com/shuber/proxy
proxy.gemspec
Ruby
mit
99
master
1,170
Gem::Specification.new do |s| s.name = 'proxy' s.version = '1.3.5' s.date = '2010-05-03' s.summary = 'A gem/plugin that allows rails applications to respond to multiple domains and proxied requests' s.description = 'A gem/plugin that allows rails applications to respond to multiple domains and pr...
github
shuber/proxy
https://github.com/shuber/proxy
Rakefile
Ruby
mit
99
master
1,003
require 'rake' require 'rake/testtask' require 'rake/rdoctask' desc 'Default: run the proxy tests' task :default => :test namespace :test do desc 'Default: run the proxy tests for all versions of actionpack' task :all do versions = `gem list`.match(/actionpack \((.+)\)/).captures[0].split(/, /).select { |v| v...
github
shuber/proxy
https://github.com/shuber/proxy
test/proxy_test.rb
Ruby
mit
99
master
1,215
require File.dirname(__FILE__) + '/init' class ProxyTest < Test::Unit::TestCase def setup @controller = TestController.new @request = ActionController::TestRequest.new def @request.host; env['HTTP_X_FORWARDED_HOST'].blank? ? env['HTTP_HOST'] : env['HTTP_X_FORWARDED_HOST'].split(/,\s/).last; end @...
github
shuber/proxy
https://github.com/shuber/proxy
test/abstract_request_test.rb
Ruby
mit
99
master
2,536
require File.dirname(__FILE__) + '/init' class AbstractRequestTest < Test::Unit::TestCase def setup @request = ActionController::TestRequest.new @request.host = 'example.com' ActionController::UrlWriter.default_url_options[:host] = nil ActionController::Base.relative_url_root = nil end def te...
github
shuber/proxy
https://github.com/shuber/proxy
test/named_route_collection_test.rb
Ruby
mit
99
master
950
require File.dirname(__FILE__) + '/init' class NamedRouteCollectionTest < Test::Unit::TestCase def setup @controller = TestController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new @request.host = 'example.com' ActionController::UrlWriter.def...
github
shuber/proxy
https://github.com/shuber/proxy
test/url_helper_test.rb
Ruby
mit
99
master
1,670
require File.dirname(__FILE__) + '/init' class UrlHelperTest < Test::Unit::TestCase def setup @controller = TestController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new @request.host = 'example.com' ActionController::UrlWriter.default_url_op...
github
shuber/proxy
https://github.com/shuber/proxy
test/base_test.rb
Ruby
mit
99
master
6,774
require File.dirname(__FILE__) + '/init' class BaseTest < Test::Unit::TestCase def setup @controller = TestController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new @request.host = 'example.com' ActionController::UrlWriter.default_url_options...
github
shuber/proxy
https://github.com/shuber/proxy
test/url_rewriter_test.rb
Ruby
mit
99
master
1,204
require File.dirname(__FILE__) + '/init' class UrlRewriter < ::ActionController::UrlRewriter public def rewrite_url super :action => :normal_action, :controller => :test end end class UrlRewriterTest < Test::Unit::TestCase def setup @controller = TestController.new @request = ActionContr...
github
shuber/proxy
https://github.com/shuber/proxy
test/init.rb
Ruby
mit
99
master
3,105
$:.reject! { |path| path.include? 'TextMate' } require 'test/unit' # Load rubygems # require 'rubygems' # Load ActionPack # args = ['actionpack'] args << ENV['ACTION_PACK_VERSION'] if ENV['ACTION_PACK_VERSION'] gem *args require 'action_pack' require 'action_controller' require 'action_controller/dispatcher' require ...
github
shuber/proxy
https://github.com/shuber/proxy
lib/proxy.rb
Ruby
mit
99
master
1,955
require 'proxy/action_controller/abstract_request' require 'proxy/action_controller/base' require 'proxy/action_controller/named_route_collection' require 'proxy/action_controller/url_rewriter' require 'proxy/action_view/url_helper' module Proxy mattr_accessor :replace_host_with_proc self.replace_host_with_proc = ...
github
shuber/proxy
https://github.com/shuber/proxy
lib/proxy/action_controller/base.rb
Ruby
mit
99
master
5,695
module Proxy module ActionController module Base def self.included(base) base.class_eval do before_filter :set_proxy_relative_url_root around_filter :swap_default_host around_filter :swap_relative_url_root around_filter :swap_session_domain cattr_acc...
github
shuber/proxy
https://github.com/shuber/proxy
lib/proxy/action_controller/abstract_request.rb
Ruby
mit
99
master
1,617
module Proxy module ActionController module AbstractRequest def self.included(base) base.class_eval do mattr_accessor :forwarded_uri_header_name self.forwarded_uri_header_name = 'HTTP_X_FORWARDED_URI' memoize :forwarded_hosts, :forwarded_uris if respond_to? :memoize ...
github
shuber/proxy
https://github.com/shuber/proxy
lib/proxy/action_controller/url_rewriter.rb
Ruby
mit
99
master
765
module Proxy module ActionController module UrlRewriter def self.included(base) base.class_eval { alias_method_chain :rewrite_url, :proxy } end # Adds the default :host option unless already specified # # It will not set the :host option if <tt>options</tt> is not a hash...
github
shuber/proxy
https://github.com/shuber/proxy
lib/proxy/action_controller/named_route_collection.rb
Ruby
mit
99
master
1,022
module Proxy module ActionController module NamedRouteCollection def self.included(base) base.class_eval { alias_method_chain :define_url_helper, :proxy } end # Named route url helpers (not path helpers) don't seem to work correctly # with forwarded hosts unless we explicitly...
github
shuber/proxy
https://github.com/shuber/proxy
lib/proxy/action_view/url_helper.rb
Ruby
mit
99
master
750
module Proxy module ActionView module UrlHelper def self.included(base) base.class_eval { alias_method_chain :url_for, :proxy } end # Adds the default :host option unless already specified # # It will not set the :host option if <tt>options</tt> is not a hash or # ...
github
robolson/ruby-poker
https://github.com/robolson/ruby-poker
Rakefile
Ruby
bsd-3-clause
99
master
424
require 'rake/testtask' Rake::TestTask.new do |t| t.libs = ['lib'] t.verbose = true t.warning = true t.test_files = FileList['test/test_card.rb', 'test/test_poker_hand.rb', 'test/test_full_house.rb'] end Rake::TestTask.new do |t| t.libs = ['lib'] t.name = 'test:integration' t.verbose = true t.warning =...
github
robolson/ruby-poker
https://github.com/robolson/ruby-poker
ruby-poker.gemspec
Ruby
bsd-3-clause
99
master
1,298
Gem::Specification.new do |s| s.name = "ruby-poker" s.version = "1.0.1" s.platform = Gem::Platform::RUBY s.summary = "Poker library in Ruby" s.description = "Ruby library for comparing poker hands and determining the winner." s.author = "Rob Olson" s.email = "rob@thinkingdigitally.com" s.home...
github
robolson/ruby-poker
https://github.com/robolson/ruby-poker
test/test_full_house.rb
Ruby
bsd-3-clause
99
master
1,202
require File.expand_path(File.dirname(__FILE__) + '/test_helper') class TestFullHouse < Test::Unit::TestCase context "A Full House should return the correct cards from sort_using_rank" do setup do @fh_high_pair = PokerHand.new("8h 8d 8c Qh Td Kd Ks") @fh_low_pair = PokerHand.new("8h 8d 8c Qh Td 4h ...
github
robolson/ruby-poker
https://github.com/robolson/ruby-poker
test/test_poker_hand.rb
Ruby
bsd-3-clause
99
master
15,243
require File.expand_path(File.dirname(__FILE__) + '/test_helper') class TestPokerHand < Test::Unit::TestCase context "A PokerHand instance" do setup do @quads = PokerHand.new('Kc Kh Kd Ks Qs') @full_boat = PokerHand.new(["2H", "2D", "4C", "4D", "4S"]) @flush = PokerHand.new("3D 6D 7D TD QD 5H ...
github
robolson/ruby-poker
https://github.com/robolson/ruby-poker
test/test_card.rb
Ruby
bsd-3-clause
99
master
2,644
require File.expand_path(File.dirname(__FILE__) + '/test_helper') class TestCard < Test::Unit::TestCase def setup # testing various input formats for cards @c1 = Card.new("9c") @c2 = Card.new("TD") @c3 = Card.new("jh") @c4 = Card.new("qS") @c5 = Card.new("AC") end def test_class_face_val...
github
robolson/ruby-poker
https://github.com/robolson/ruby-poker
test/integration/test_a_million_hands.rb
Ruby
bsd-3-clause
99
master
3,127
# Instructions: # # Download 'poker-hand-testing.data' dataset from http://archive.ics.uci.edu/ml/datasets/Poker+Hand. # wget -P ./test/support/fixtures http://archive.ics.uci.edu/ml/machine-learning-databases/poker/poker-hand-testing.data # # bundle exec ruby test/integration/test_a_million_hands.rb # Attribute infor...
github
robolson/ruby-poker
https://github.com/robolson/ruby-poker
examples/deck.rb
Ruby
bsd-3-clause
99
master
1,022
# This is a sample Deck implementation. class Deck def initialize @cards = [] Card::SUITS.each_byte do |suit| # careful not to double include the aces... Card::FACES[1..-1].each_byte do |face| @cards.push(Card.new(face.chr, suit.chr)) end end shuffle end def shuffle ...
github
robolson/ruby-poker
https://github.com/robolson/ruby-poker
examples/quick_example.rb
Ruby
bsd-3-clause
99
master
230
require 'rubygems' require 'ruby-poker' hand1 = PokerHand.new("8H 9C TC JD QH") hand2 = PokerHand.new(["3D", "3C", "3S", "KD", "AH"]) puts hand1 puts hand1.just_cards puts hand1.rank puts hand2 puts hand2.rank puts hand1 > hand2
github
robolson/ruby-poker
https://github.com/robolson/ruby-poker
lib/ruby-poker/poker_hand.rb
Ruby
bsd-3-clause
99
master
15,994
class PokerHand include Comparable include Enumerable attr_reader :hand @@allow_duplicates = true # true by default def self.allow_duplicates; @@allow_duplicates; end def self.allow_duplicates=(v); @@allow_duplicates = v; end # Returns a new PokerHand object. Accepts the cards represented # in a st...
github
robolson/ruby-poker
https://github.com/robolson/ruby-poker
lib/ruby-poker/card.rb
Ruby
bsd-3-clause
99
master
3,464
class Card SUITS = "cdhs" FACES = "L23456789TJQKA" SUIT_LOOKUP = { 'c' => 0, 'd' => 1, 'h' => 2, 's' => 3 } FACE_VALUES = { 'L' => 0, # this is a low ace '2' => 1, '3' => 2, '4' => 3, '5' => 4, '6' => 5, '7' => 6, '8' => 7, '9' => 8, 'T' => 9...
github
zengin-code/zengin-rb
https://github.com/zengin-code/zengin-rb
zengin_code.gemspec
Ruby
mit
99
master
1,088
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'zengin_code/version' Gem::Specification.new do |spec| spec.name = "zengin_code" spec.version = ZenginCode::VERSION.sub('-p', '.') spec.authors = ["Sho Kusano"] spec.e...
github
zengin-code/zengin-rb
https://github.com/zengin-code/zengin-rb
lib/zengin_code.rb
Ruby
mit
99
master
627
require 'json' require 'zengin_code/version' require 'zengin_code/bank' require 'zengin_code/branch' module ZenginCode class << self def preload! banks = JSON.load(File.read(DATA_DIR.join('banks.json'))) banks.values.each do |bank| ZenginCode::Bank.new(bank) end ZenginCode::Bank...
github
zengin-code/zengin-rb
https://github.com/zengin-code/zengin-rb
lib/zengin_code/bank.rb
Ruby
mit
99
master
508
require 'zengin_code' class ZenginCode::Bank @banks = {} class << self def [](code) @banks[code] end def []=(code, bank) @banks[code] = bank end def all @banks end end def initialize(options = {}) @code = options['code'] @name = options['name'] @kana = ...
github
zengin-code/zengin-rb
https://github.com/zengin-code/zengin-rb
lib/zengin_code/branch.rb
Ruby
mit
99
master
307
require 'zengin_code' class ZenginCode::Branch def initialize(bank, options = {}) @bank = bank @code = options['code'] @name = options['name'] @kana = options['kana'] @hira = options['hira'] @roma = options['roma'] end attr_reader :bank, :code, :name, :kana, :hira, :roma end
github
zengin-code/zengin-rb
https://github.com/zengin-code/zengin-rb
lib/zengin_code/version.rb
Ruby
mit
99
master
304
require 'pathname' module ZenginCode ROOT_DIR = Pathname.new(File.expand_path(__FILE__)).join('../../..') DATA_DIR = ROOT_DIR.join('source-data', 'data') GEM_VERSION = '1.0.1' def self.version "#{GEM_VERSION}-p#{File.read(DATA_DIR.join('updated_at')).strip}" end VERSION = version end
github
jedld/pretentious
https://github.com/jedld/pretentious
test_classes.rb
Ruby
mit
99
master
3,792
require 'digest/md5' class Fibonacci def fib(n) return 0 if (n == 0) return 1 if (n == 1) return 1 if (n == 2) return fib(n - 1) + fib(n - 2) end def self.say_hello "hello" end end class Meme def i_can_has_cheezburger? "OHAI!" end def will_it_blend? "YES!" end end clas...
github
jedld/pretentious
https://github.com/jedld/pretentious
pretentious.gemspec
Ruby
mit
99
master
1,557
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'pretentious/version' Gem::Specification.new do |spec| spec.name = "pretentious" spec.version = Pretentious::VERSION spec.authors = ["Joseph Emmanuel Dayo"] spec.email...
github
jedld/pretentious
https://github.com/jedld/pretentious
Rakefile
Ruby
mit
99
master
315
require 'rspec/core/rake_task' require "bundler/gem_tasks" RSpec::Core::RakeTask.new('spec') # If you want to make this the default task task :default => :spec task :test => :spec desc "Runs the minitest suite" task :minitest do $: << './test' Dir.glob('./test/**/test_*.rb').each { |file| require file} end
github
jedld/pretentious
https://github.com/jedld/pretentious
sample.rb
Ruby
mit
99
master
514
class Meme def i_can_has_cheezburger? "OHAI!" end def will_it_blend? "YES!" end end meme = Meme.new meme.i_can_has_cheezburger? meme.will_it_blend? class TestClassR1 SOME_CONSTANT = "CONST" def hello end end class TestClassR2 def hello_again "hi" end def pass_message(message) "...
github
jedld/pretentious
https://github.com/jedld/pretentious
example.rb
Ruby
mit
99
master
2,591
$LOAD_PATH << '.' require 'digest/md5' require_relative './test_classes.rb' [:spec_for, :minitest_for].each do |method| Pretentious.send(method, Fibonacci) do instance = Fibonacci.new (1..5).each do |n| instance.fib(n) end Fibonacci.say_hello end end [:spec_for, :minitest_for].each do |...
github
jedld/pretentious
https://github.com/jedld/pretentious
spec/deconstructor_spec.rb
Ruby
mit
99
master
6,122
require 'spec_helper' RSpec.describe Pretentious::Deconstructor do before do @fixture = Pretentious::Deconstructor.new end describe "#build_tree" do it "should decompose an object" do message = 'test' another_object = Pretentious.watch { TestClass1.new(message) } # Prete...
github
jedld/pretentious
https://github.com/jedld/pretentious
spec/lazy_trigger_spec.rb
Ruby
mit
99
master
2,829
require 'spec_helper' RSpec.describe Pretentious::LazyTrigger do it 'Can predeclare even if the class is not yet defined' do Pretentious.watch do lazy_trigger = Pretentious::LazyTrigger.new('TestLazyClass') class TestLazyClass def test_method end end lazy_class = TestLaz...
github
jedld/pretentious
https://github.com/jedld/pretentious
spec/prententious_spec.rb
Ruby
mit
99
master
5,651
require 'spec_helper' RSpec.describe Pretentious::Generator do context 'Pretentious::Generator' do before do @fixture = Pretentious::Generator.new Pretentious::Generator.test_generator = Pretentious::RspecGenerator end it "uses instance variables when used both in test and in fixtures" do ...
github
jedld/pretentious
https://github.com/jedld/pretentious
spec/minitest_generator_spec.rb
Ruby
mit
99
master
2,496
require 'spec_helper' RSpec.describe Pretentious::Generator do context 'Pretentious::MinitestGenerator' do before do @fixture = Pretentious::Generator.new Pretentious::Generator.test_generator = Pretentious::MinitestGenerator end it "classes should have a stub class section" do Fibon...
github
jedld/pretentious
https://github.com/jedld/pretentious
spec/generator_spec.rb
Ruby
mit
99
master
7,945
require 'spec_helper' class TestSubClass def test_method "a return string" end end class TestClass def initialize(dep = nil) @test_class2 = TestSubClass.new end def message(params1) @params1 = params1 end def method_with_assign=(params2) @params2 = "#{params2}!" end def method_wit...
github
jedld/pretentious
https://github.com/jedld/pretentious
spec/utils/filewriter_spec.rb
Ruby
mit
99
master
878
require 'spec_helper' describe Pretentious::FileWriter do before do Pretentious.clear_results Pretentious.spec_for(TestClass1) do message = { test: 'message' } object = TestClass1.new(message) object.return_self(message) end @last_results = Pretentious.last_results @instance = ...
github
jedld/pretentious
https://github.com/jedld/pretentious
spec/generated/test_class_r1_spec.rb
Ruby
mit
99
master
345
# This file was automatically generated by the pretentious gem require 'spec_helper' RSpec.describe TestClassR1 do context 'Scenario 1' do before do @fixture = TestClassR1.new end it 'should pass current expectations' do # TestClassR1#hello should return nil expect(@fixture.hello).to ...
github
jedld/pretentious
https://github.com/jedld/pretentious
spec/generated/test_class1_spec.rb
Ruby
mit
99
master
2,080
# This file was automatically generated by the pretentious gem require 'spec_helper' RSpec.describe TestClass1 do context 'Scenario 1' do before do @fixture = TestClass1.new('test') end it 'should pass current expectations' do # TestClass1#message should return 'test' expect(@fixture....
github
jedld/pretentious
https://github.com/jedld/pretentious
spec/generated/fibonacci_spec.rb
Ruby
mit
99
master
964
# This file was automatically generated by the pretentious gem require 'spec_helper' RSpec.describe Fibonacci do context 'Scenario 1' do before do @fixture = Fibonacci.new end it 'should pass current expectations' do n = 1 n_1 = 2 n_2 = 3 n_3 = 4 n_4 = 5 # Fibon...
github
jedld/pretentious
https://github.com/jedld/pretentious
spec/generated/test_class4_spec.rb
Ruby
mit
99
master
304
# This file was automatically generated by the pretentious gem require 'spec_helper' RSpec.describe TestClass4 do context 'Scenario 1' do before do b = proc { 'test' } @fixture = TestClass4.new(&b) end it 'should pass current expectations' do end end end
github
jedld/pretentious
https://github.com/jedld/pretentious
spec/generated/meme_spec.rb
Ruby
mit
99
master
469
# This file was automatically generated by the pretentious gem require 'spec_helper' RSpec.describe Meme do context 'Scenario 1' do before do @fixture = Meme.new end it 'should pass current expectations' do # Meme#i_can_has_cheezburger? should return 'OHAI!' expect(@fixture.i_can_has_...
github
jedld/pretentious
https://github.com/jedld/pretentious
spec/generated/test_class_for_auto_stub_spec.rb
Ruby
mit
99
master
739
# This file was automatically generated by the pretentious gem require 'spec_helper' RSpec.describe TestClassForAutoStub do context 'Scenario 1' do before do @fixture = TestClassForAutoStub.new end it 'should pass current expectations' do a = ['Hello Glorious world', 'HI THERE!!!!'] al...
github
jedld/pretentious
https://github.com/jedld/pretentious
spec/generated/test_class_r2_spec.rb
Ruby
mit
99
master
533
# This file was automatically generated by the pretentious gem require 'spec_helper' RSpec.describe TestClassR2 do context 'Scenario 1' do before do @fixture = TestClassR2.new end it 'should pass current expectations' do # TestClassR2#hello_again should return 'hi' expect(@fixture.hel...
github
jedld/pretentious
https://github.com/jedld/pretentious
spec/generated/m_d5_spec.rb
Ruby
mit
99
master
397
# This file was automatically generated by the pretentious gem require 'spec_helper' RSpec.describe Digest::MD5 do it 'should pass current expectations' do sample = 'This is the digest' # Digest::MD5::hexdigest when passed "This is the digest" should return '9f12248dcddeda976611d192efaaf72a' expect(Diges...
github
jedld/pretentious
https://github.com/jedld/pretentious
spec/generated/test_class2_spec.rb
Ruby
mit
99
master
939
# This file was automatically generated by the pretentious gem require 'spec_helper' RSpec.describe TestClass2 do context 'Scenario 1' do before do @fixture = TestClass2.new('This is message 2', nil) end it 'should pass current expectations' do # TestClass2#print_message should return nil ...
github
jedld/pretentious
https://github.com/jedld/pretentious
spec/generated/test_class_for_mocks_spec.rb
Ruby
mit
99
master
1,527
# This file was automatically generated by the pretentious gem require 'spec_helper' RSpec.describe TestClassForMocks do context 'Scenario 1' do before do @fixture = TestClassForMocks.new end it 'should pass current expectations' do a = [2, 3, 4, 5] allow_any_instance_of(TestMockSubCla...
github
jedld/pretentious
https://github.com/jedld/pretentious
spec/generated/test_class3_spec.rb
Ruby
mit
99
master
1,275
# This file was automatically generated by the pretentious gem require 'spec_helper' RSpec.describe TestClass3 do context 'Scenario 1' do before do another_object = TestClass1.new('test') b = { hello: 'world', test: another_object, arr_1: [1, 2, 3, 4, 5, another_object], sub_hash: { yes: true, obj: a...
github
jedld/pretentious
https://github.com/jedld/pretentious
test/test_generator.rb
Ruby
mit
99
master
3,259
require 'pretentious' require 'digest/md5' require 'json' class Fibonacci def fib(n) return 0 if (n == 0) return 1 if (n == 1) return 1 if (n == 2) return fib(n - 1) + fib(n - 2) end def self.say_hello "hello" end end class TestClass1 def initialize(message) @message = message ...
github
jedld/pretentious
https://github.com/jedld/pretentious
test/generated/test_test_class_r1.rb
Ruby
mit
99
master
464
# This file was automatically generated by the pretentious gem require 'minitest_helper' require 'minitest/autorun' class TestClassR1Test < Minitest::Test end class TestClassR1Scenario1 < TestClassR1Test def setup @fixture = TestClassR1.new end def test_current_expectation # TestClassR1#hello should r...
github
jedld/pretentious
https://github.com/jedld/pretentious
test/generated/test_fibonacci.rb
Ruby
mit
99
master
988
# This file was automatically generated by the pretentious gem require 'minitest_helper' require 'minitest/autorun' class FibonacciTest < Minitest::Test end class FibonacciScenario1 < FibonacciTest def setup @fixture = Fibonacci.new end def test_current_expectation n = 1 n_1 = 2 n_2 = 3 n_3...
github
jedld/pretentious
https://github.com/jedld/pretentious
test/generated/test_test_class_r2.rb
Ruby
mit
99
master
559
# This file was automatically generated by the pretentious gem require 'minitest_helper' require 'minitest/autorun' class TestClassR2Test < Minitest::Test end class TestClassR2Scenario1 < TestClassR2Test def setup @fixture = TestClassR2.new end def test_current_expectation # TestClassR2#hello_again sh...
github
jedld/pretentious
https://github.com/jedld/pretentious
test/generated/test_m_d5.rb
Ruby
mit
99
master
475
# This file was automatically generated by the pretentious gem require 'minitest_helper' require 'minitest/autorun' class Digest::MD5Test < Minitest::Test end class Digest::MD5Scenario1 < Digest::MD5Test def test_current_expectation sample = 'This is the digest' # Digest::MD5::hexdigest when passed "This i...
github
jedld/pretentious
https://github.com/jedld/pretentious
test/generated/test_test_class_for_mocks.rb
Ruby
mit
99
master
1,543
# This file was automatically generated by the pretentious gem require 'minitest_helper' require 'minitest/autorun' class TestClassForMocksTest < Minitest::Test end class TestClassForMocksScenario1 < TestClassForMocksTest def setup @fixture = TestClassForMocks.new end def test_current_expectation a = [...
github
jedld/pretentious
https://github.com/jedld/pretentious
test/generated/test_test_class4.rb
Ruby
mit
99
master
332
# This file was automatically generated by the pretentious gem require 'minitest_helper' require 'minitest/autorun' class TestClass4Test < Minitest::Test end class TestClass4Scenario1 < TestClass4Test def setup b = proc { 'test' } @fixture = TestClass4.new(&b) end def test_current_expectati...
github
jedld/pretentious
https://github.com/jedld/pretentious
test/generated/test_meme.rb
Ruby
mit
99
master
481
# This file was automatically generated by the pretentious gem require 'minitest_helper' require 'minitest/autorun' class MemeTest < Minitest::Test end class MemeScenario1 < MemeTest def setup @fixture = Meme.new end def test_current_expectation # Meme#i_can_has_cheezburger? should return 'OHAI!' ...
github
jedld/pretentious
https://github.com/jedld/pretentious
test/generated/test_test_class3.rb
Ruby
mit
99
master
1,276
# This file was automatically generated by the pretentious gem require 'minitest_helper' require 'minitest/autorun' class TestClass3Test < Minitest::Test end class TestClass3Scenario1 < TestClass3Test def setup another_object = TestClass1.new('test') b = { hello: 'world', test: another_object, arr_1: [1, 2,...
github
jedld/pretentious
https://github.com/jedld/pretentious
test/generated/test_test_class2.rb
Ruby
mit
99
master
949
# This file was automatically generated by the pretentious gem require 'minitest_helper' require 'minitest/autorun' class TestClass2Test < Minitest::Test end class TestClass2Scenario1 < TestClass2Test def setup @fixture = TestClass2.new('This is message 2', nil) end def test_current_expectation # TestC...
github
jedld/pretentious
https://github.com/jedld/pretentious
test/generated/test_test_class1.rb
Ruby
mit
99
master
2,026
# This file was automatically generated by the pretentious gem require 'minitest_helper' require 'minitest/autorun' class TestClass1Test < Minitest::Test end class TestClass1Scenario1 < TestClass1Test def setup @fixture = TestClass1.new('test') end def test_current_expectation # TestClass1#message sho...
github
jedld/pretentious
https://github.com/jedld/pretentious
lib/pretentious.rb
Ruby
mit
99
master
3,610
require 'pretentious/version' require 'pretentious/context' require 'pretentious/generator_base' require 'pretentious/rspec_generator' require 'pretentious/minitest_generator' require 'pretentious/recorded_proc' require 'pretentious/generator' require 'binding_of_caller' require 'pretentious/deconstructor' require 'pre...
github
jedld/pretentious
https://github.com/jedld/pretentious
lib/pretentious/recorded_proc.rb
Ruby
mit
99
master
704
module Pretentious # Sublass of Proc that records whatever was passed to it and whatever it returns class RecordedProc < Proc attr_reader :target_proc, :return_value def initialize(target_proc, is_given_block = false) @target_proc = target_proc @return_value = [] @args = [] @given_b...
github
jedld/pretentious
https://github.com/jedld/pretentious
lib/pretentious/lazy_trigger.rb
Ruby
mit
99
master
3,207
module Pretentious class LazyTrigger attr_accessor :target_class, :options, :targets class Target attr_accessor :stand_in_klass, :original_klass, :module_space, :name def initialize(module_space, klass, last_part, stand_in_class) @module_space = module_space @stand_in_klass = sta...
github
jedld/pretentious
https://github.com/jedld/pretentious
lib/pretentious/minitest_generator.rb
Ruby
mit
99
master
8,037
module Pretentious # Generator that outputs minitest specs class MinitestGenerator < Pretentious::GeneratorBase def self.to_sym :minitest end def begin_spec(test_class) @test_class = test_class buffer('# This file was automatically generated by the pretentious gem') buffer("requ...
github
jedld/pretentious
https://github.com/jedld/pretentious
lib/pretentious/rspec_generator.rb
Ruby
mit
99
master
7,238
module Pretentious # Generator for RSPEC class RspecGenerator < Pretentious::GeneratorBase def self.to_sym :spec end def begin_spec(test_class) buffer('# This file was automatically generated by the pretentious gem') buffer("require 'spec_helper'") whitespace buffer("RSpec...
github
jedld/pretentious
https://github.com/jedld/pretentious
lib/pretentious/generator_base.rb
Ruby
mit
99
master
2,885
module Pretentious # base class for spec generators class GeneratorBase def initialize(options = {}) @deconstructor = Pretentious::Deconstructor.new indentation_count = options[:indentation] || 2 @output_buffer = '' @_indentation = '' indentation_count.times do @_indentatio...
github
jedld/pretentious
https://github.com/jedld/pretentious
lib/pretentious/deconstructor.rb
Ruby
mit
99
master
11,628
module Pretentious # Deconstructor - decompose an object into its parts class Deconstructor # Represents an unresolved class class UnResolved attr_accessor :target_object def initialize(object) @target_object = object end end # Represents a reference class Reference ...
github
jedld/pretentious
https://github.com/jedld/pretentious
lib/pretentious/trigger.rb
Ruby
mit
99
master
3,054
module Pretentious # The trigger class is used for hooking into an existing method # in order to record the usage of a target class class Trigger # options that ca be passed to a trigger class Options attr_accessor :output_folder end def initialize(target_class) @target_class = target...
github
jedld/pretentious
https://github.com/jedld/pretentious
lib/pretentious/generator.rb
Ruby
mit
99
master
16,193
module Pretentious # A class that generates specs by analyzing how an object is used class Generator def self.test_generator=(generator) @test_generator = generator end def self.test_generator @test_generator || Pretentious::RspecGenerator end def self.impostor_for(module_space, k...
github
jedld/pretentious
https://github.com/jedld/pretentious
lib/pretentious/context.rb
Ruby
mit
99
master
3,378
module Pretentious # Contains references to scoped variables class Context # list of variable names to use. i j are not there on purpose VARIABLE_NAMES = %w(a b c d e f g h k l m n o p q r s t u v w x y z) attr_accessor :declared_names, :variable_map, :previous_declarations def i...
github
jedld/pretentious
https://github.com/jedld/pretentious
lib/pretentious/utils/file_writer.rb
Ruby
mit
99
master
1,051
module Pretentious # Utility function for saving pretentious test artifacts to a file. class FileWriter # options for the file writer def initialize(options = {}) @spec_output_folder ||= (options[:spec_output_folder] || 'generated') @output_folder = options[:output_folder] || nil end de...
github
joyofrails/joyofrails.com
https://github.com/joyofrails/joyofrails.com
Gemfile
Ruby
bsd-3-clause
99
main
7,719
source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby file: ".ruby-version" gem "rails" gem "puma", ">= 5.0" # Use the Puma web server [https://github.com/puma/puma] gem "sqlite3", force_ruby_platform: true # Use sqlite3 as the database for Active Record [https://github.c...
github
joyofrails/joyofrails.com
https://github.com/joyofrails/joyofrails.com
Rakefile
Ruby
bsd-3-clause
99
main
371
# Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require_relative "config/application" Rails.application.load_tasks task default: %i[ standard spec db:seed vitest:run brakeman:run bundler:audit ] ...
github
joyofrails/joyofrails.com
https://github.com/joyofrails/joyofrails.com
db/seeds.rb
Ruby
bsd-3-clause
99
main
523
# This file should ensure the existence of records required to run the application in every environment (production, # development, test). The code here should be idempotent so that it can be executed at any point in every environment. # The data can then be loaded with the bin/rails db:seed command (or created alongsi...
github
joyofrails/joyofrails.com
https://github.com/joyofrails/joyofrails.com
db/schema.rb
Ruby
bsd-3-clause
99
main
12,293
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # This file is the source Rails uses to define your schema when running `bin/rai...
github
joyofrails/joyofrails.com
https://github.com/joyofrails/joyofrails.com
db/cache_schema.rb
Ruby
bsd-3-clause
99
main
1,518
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # This file is the source Rails uses to define your schema when running `bin/rai...
github
joyofrails/joyofrails.com
https://github.com/joyofrails/joyofrails.com
db/queue_schema.rb
Ruby
bsd-3-clause
99
main
7,507
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # This file is the source Rails uses to define your schema when running `bin/rai...
github
joyofrails/joyofrails.com
https://github.com/joyofrails/joyofrails.com
db/cable_schema.rb
Ruby
bsd-3-clause
99
main
1,228
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # This file is the source Rails uses to define your schema when running `bin/rai...
github
joyofrails/joyofrails.com
https://github.com/joyofrails/joyofrails.com
db/migrate/20241128135050_create_polls_votes.rb
Ruby
bsd-3-clause
99
main
335
class CreatePollsVotes < ActiveRecord::Migration[8.0] def change create_table :polls_votes do |t| t.references :answer, null: false, foreign_key: {to_table: :polls_answers} t.references :user, null: true, foreign_key: true, type: :string t.string :device_uuid, index: true t.timestamps ...
github
joyofrails/joyofrails.com
https://github.com/joyofrails/joyofrails.com
db/migrate/20240701121018_create_color_scales.rb
Ruby
bsd-3-clause
99
main
700
class CreateColorScales < ActiveRecord::Migration[7.1] def change create_table :color_scales, force: true, id: false do |t| t.primary_key :id, :string, default: -> { "ULID()" } t.string :name, null: false t.string :weight_50, null: false t.string :weight_100, null: false t.string :we...
github
joyofrails/joyofrails.com
https://github.com/joyofrails/joyofrails.com
db/migrate/20241109030814_create_topics.rb
Ruby
bsd-3-clause
99
main
372
class CreateTopics < ActiveRecord::Migration[8.0] def change create_table :topics do |t| t.string :name t.text :description t.string :slug, null: false, index: {unique: true} t.string :status, null: false, default: "pending", index: true t.integer :pages_count, null: false, default: ...
github
joyofrails/joyofrails.com
https://github.com/joyofrails/joyofrails.com
db/migrate/20240905104301_alter_snippets_change_url_to_description.rb
Ruby
bsd-3-clause
99
main
206
class AlterSnippetsChangeUrlToDescription < ActiveRecord::Migration[7.2] def up rename_column :snippets, :url, :description end def down rename_column :snippets, :description, :url end end
github
joyofrails/joyofrails.com
https://github.com/joyofrails/joyofrails.com
db/migrate/20241128133612_create_polls_questions.rb
Ruby
bsd-3-clause
99
main
307
class CreatePollsQuestions < ActiveRecord::Migration[8.0] def change create_table :polls_questions do |t| t.string :body, null: false t.references :poll, null: false, foreign_key: true, type: :string t.integer :position, null: false, default: 0 t.timestamps end end end
github
joyofrails/joyofrails.com
https://github.com/joyofrails/joyofrails.com
db/migrate/20240806232759_create_newsletters.rb
Ruby
bsd-3-clause
99
main
335
class CreateNewsletters < ActiveRecord::Migration[7.1] def change create_table :newsletters, force: true, id: false do |t| t.primary_key :id, :string, default: -> { "ULID()" } t.string :title, null: false t.text :content, null: false t.datetime :sent_at, index: true t.timestamps ...
github
joyofrails/joyofrails.com
https://github.com/joyofrails/joyofrails.com
db/migrate/20240107205755_create_admin_users.rb
Ruby
bsd-3-clause
99
main
259
class CreateAdminUsers < ActiveRecord::Migration[7.1] def change create_table :admin_users do |t| t.string :email t.string :password_digest, null: false t.timestamps end add_index :admin_users, :email, unique: true end end
github
joyofrails/joyofrails.com
https://github.com/joyofrails/joyofrails.com
db/migrate/20241128133144_create_polls.rb
Ruby
bsd-3-clause
99
main
350
class CreatePolls < ActiveRecord::Migration[8.0] def change create_table :polls, force: true, id: false do |t| t.primary_key :id, :string, default: -> { "ULID()" } t.belongs_to :author, null: false, foreign_key: {to_table: :users}, type: :string t.string :title, null: false, index: true t...
github
joyofrails/joyofrails.com
https://github.com/joyofrails/joyofrails.com
db/migrate/20240609132723_create_notifications.rb
Ruby
bsd-3-clause
99
main
368
class CreateNotifications < ActiveRecord::Migration[7.1] def change create_table :notifications do |t| t.string :type t.references :notification_event, null: false, foreign_key: true t.references :recipient, polymorphic: true, null: false, type: :string t.datetime :read_at t.datetime...
github
joyofrails/joyofrails.com
https://github.com/joyofrails/joyofrails.com
db/migrate/20240605030240_create_users.rb
Ruby
bsd-3-clause
99
main
338
class CreateUsers < ActiveRecord::Migration[7.1] def change create_table :users, force: true, id: false do |t| t.primary_key :id, :string, default: -> { "ULID()" } t.string :email, null: false t.string :password_digest, null: false t.timestamps end add_index :users, :email, uniqu...
github
joyofrails/joyofrails.com
https://github.com/joyofrails/joyofrails.com
db/migrate/20240703114157_create_color_schemes.rb
Ruby
bsd-3-clause
99
main
725
class CreateColorSchemes < ActiveRecord::Migration[7.1] def change create_table :color_schemes, force: true, id: false do |t| t.primary_key :id, :string, default: -> { "ULID()" } t.string :name, null: false, index: {unique: true} t.string :weight_50, null: false t.string :weight_100, null:...
github
joyofrails/joyofrails.com
https://github.com/joyofrails/joyofrails.com
db/migrate/20240609132719_create_notification_events.rb
Ruby
bsd-3-clause
99
main
249
class CreateNotificationEvents < ActiveRecord::Migration[7.1] def change create_table :notification_events do |t| t.string :type t.json :params t.integer :notifications_count, default: 0 t.timestamps end end end
github
joyofrails/joyofrails.com
https://github.com/joyofrails/joyofrails.com
db/migrate/20240816235642_create_snippets.rb
Ruby
bsd-3-clause
99
main
322
class CreateSnippets < ActiveRecord::Migration[7.1] def change create_table :snippets, force: true, id: false do |t| t.primary_key :id, :string, default: -> { "ULID()" } t.text :source, null: false t.string :filename t.string :language t.text :url t.timestamps end end en...
github
joyofrails/joyofrails.com
https://github.com/joyofrails/joyofrails.com
db/migrate/20241206145040_create_page_polls.rb
Ruby
bsd-3-clause
99
main
347
class CreatePagePolls < ActiveRecord::Migration[8.0] def change create_table :page_polls do |t| t.references :page, null: false, foreign_key: true, type: :string t.references :poll, null: false, foreign_key: true, type: :string t.timestamps end add_index :page_polls, [:page_id, :poll_i...
github
joyofrails/joyofrails.com
https://github.com/joyofrails/joyofrails.com
db/migrate/20240703114144_drop_color_scales.rb
Ruby
bsd-3-clause
99
main
741
class DropColorScales < ActiveRecord::Migration[7.1] def up drop_table :color_scales end def down create_table :color_scales, force: true, id: false do |t| t.primary_key :id, :string, default: -> { "ULID()" } t.string :name, null: false t.string :weight_50, null: false t.string :w...