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 | airbnb/interferon | https://github.com/airbnb/interferon | lib/interferon/alert_yaml.rb | Ruby | mit | 237 | master | 2,939 | # frozen_string_literal: true
module Interferon
class AlertYaml < Alert
def initialize(alert_repo_path, alert_file_path, options = {})
super
@data = nil
@scope = nil
@notify = nil
end
def to_s
@filename
end
def evaluate(hostinfo)
safe_hostinfo = Hash.new('')... |
github | airbnb/interferon | https://github.com/airbnb/interferon | lib/interferon/work_hours_helper.rb | Ruby | mit | 237 | master | 655 | # frozen_string_literal: true
require 'tzinfo'
module Interferon
class WorkHoursHelper
DEFAULT_WORK_DAYS = (1..5)
DEFAULT_WORK_HOURS = (9..16)
DEFAULT_WORK_TIMEZONE = 'America/Los_Angeles'.freeze
DEFAULT_WORK_ARGS = {
hours: DEFAULT_WORK_HOURS,
days: DEFAULT_WORK_DAYS,
timezone: DE... |
github | airbnb/interferon | https://github.com/airbnb/interferon | lib/interferon/alert_dsl.rb | Ruby | mit | 237 | master | 4,178 | # frozen_string_literal: true
require 'interferon/work_hours_helper'
module Interferon
module DSLMixin
def initialize(hostinfo)
@hostinfo = hostinfo
end
def method_missing(meth, *_args)
raise ArgumentError, "No such alerts field '#{meth}'"
end
def [](arg)
send(arg)
end
... |
github | airbnb/interferon | https://github.com/airbnb/interferon | lib/interferon/alert_sources/filesystem.rb | Ruby | mit | 237 | master | 1,531 | # frozen_string_literal: true
include ::Interferon::Logging
module Interferon::AlertSources
class Filesystem
def initialize(options)
alert_types = options['alert_types']
raise ArgumentError, 'missing alert_types for loading alerts from filesystem' \
unless alert_types
alert_types.each... |
github | airbnb/interferon | https://github.com/airbnb/interferon | lib/interferon/host_sources/aws_elasticache.rb | Ruby | mit | 237 | master | 2,014 | # frozen_string_literal: true
require 'aws'
module Interferon::HostSources
class AwsElasticache
def initialize(options)
missing = %w[access_key_id secret_access_key].reject { |r| options.key?(r) }
if missing.empty?
AWS.config(access_key_id: options['access_key_id'],
secre... |
github | airbnb/interferon | https://github.com/airbnb/interferon | lib/interferon/host_sources/aws_dynamo.rb | Ruby | mit | 237 | master | 1,272 | # frozen_string_literal: true
require 'aws'
module Interferon::HostSources
class AwsDynamo
def initialize(options)
missing = %w[access_key_id secret_access_key].reject { |r| options.key?(r) }
if missing.empty?
AWS.config(access_key_id: options['access_key_id'],
secret_acc... |
github | airbnb/interferon | https://github.com/airbnb/interferon | lib/interferon/host_sources/aws_rds.rb | Ruby | mit | 237 | master | 2,781 | # frozen_string_literal: true
require 'aws'
module Interferon::HostSources
class AwsRds
def initialize(options)
missing = %w[access_key_id secret_access_key].reject { |r| options.key?(r) }
if missing.empty?
AWS.config(access_key_id: options['access_key_id'],
secret_access... |
github | airbnb/interferon | https://github.com/airbnb/interferon | lib/interferon/host_sources/optica.rb | Ruby | mit | 237 | master | 989 | # frozen_string_literal: true
require 'net/http'
require 'json'
module Interferon::HostSources
class Optica
include ::Interferon::Logging
def initialize(options)
raise ArgumentError, 'missing host for optica source' \
unless options['host']
@host = options['host']
@port = options... |
github | airbnb/interferon | https://github.com/airbnb/interferon | lib/interferon/host_sources/optica_services.rb | Ruby | mit | 237 | master | 2,110 | # frozen_string_literal: true
require 'net/http'
require 'json'
require 'set'
module Interferon::HostSources
class OpticaServices
include ::Interferon::Logging
def initialize(options)
raise ArgumentError, 'missing host for optica source' \
unless options['host']
@host = options['host']... |
github | airbnb/interferon | https://github.com/airbnb/interferon | lib/interferon/group_sources/filesystem.rb | Ruby | mit | 237 | master | 1,616 | # frozen_string_literal: true
module Interferon::GroupSources
class Filesystem
include ::Interferon::Logging
def initialize(options)
raise ArgumentError, 'missing paths for loading groups from filesystem' \
unless options['paths']
@paths = options['paths']
end
def list_groups
... |
github | airbnb/interferon | https://github.com/airbnb/interferon | lib/interferon/destinations/datadog.rb | Ruby | mit | 237 | master | 18,329 | # frozen_string_literal: true
require 'diffy'
require 'dogapi'
require 'parallel'
require 'set'
Diffy::Diff.default_format = :text
module Interferon::Destinations
class Datadog
include ::Interferon::Logging
attr_accessor :concurrency
attr_reader :alert_key
ALERT_KEY = 'This alert was created via th... |
github | rposborne/wkhtmltopdf-heroku | https://github.com/rposborne/wkhtmltopdf-heroku | wkhtmltopdf-heroku.gemspec | Ruby | mit | 237 | master | 1,013 | Gem::Specification.new do |s|
s.name = "wkhtmltopdf-heroku"
s.version = IO.read('VERSION').strip
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.required_ruby_version = '>= 1.8.7'
s.authors = ["Brad Phelan"]
s.date = Time.now.strftime('%Y-%m-%d')
... |
github | rposborne/wkhtmltopdf-heroku | https://github.com/rposborne/wkhtmltopdf-heroku | lib/wkhtmltopdf-heroku.rb | Ruby | mit | 237 | master | 454 | WKHTMLTOPDF_PATH = File.expand_path "../../bin/wkhtmltopdf-linux-amd64", __FILE__
begin
require 'pdfkit'
PDFKit.configure do |config|
config.wkhtmltopdf = WKHTMLTOPDF_PATH
end
rescue LoadError
end
begin
require 'wicked_pdf'
WickedPdf.config[:exe_path] = WKHTMLTOPDF_PATH
rescue LoadError
end
begin
r... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | problem-solving/spec/mad_lib_spec.rb | Ruby | mit | 237 | main | 683 | require "./lib/mad_lib"
RSpec.describe MadLib do
it 'can create a new mad lib' do
madlib = MadLib.new
madlib.noun("dog")
madlib.verb("walk")
madlib.adjective("blue")
madlib.adverb("quickly")
result = madlib.result
expected = "Do you walk your blue dog quickly? That's hilarious!"
ex... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | problem-solving/spec/retirement_spec.rb | Ruby | mit | 237 | main | 859 | require "./lib/retirement"
RSpec.describe Retirement do
it 'can tell me when I should retire' do
retire = Retirement.new
result = retire.calculate(25, 65)
expected = "You have 40 years left until you can retire. It is 2015, so you can retire in 2055."
expect(result).to eq(expected)
end
it 'te... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | problem-solving/spec/escape_characters_spec.rb | Ruby | mit | 237 | main | 526 | require "./lib/escape_characters"
RSpec.describe EscapeCharacters do
it 'can add quotation marks' do
ec = EscapeCharacters.new
result = ec.quote("These aren't the droids you're looking for.")
expected = "\"These aren't the droids you're looking for.\""
expect(result).to eq(expected)
end
it 'c... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | problem-solving/spec/hello_spec.rb | Ruby | mit | 237 | main | 406 | require "./lib/hello"
RSpec.describe Hello do
it 'says hello to Brian' do
hello = Hello.new
result = hello.greet("Brian")
expected = "Hello, Brian, nice to meet you!"
expect(result).to eq(expected)
end
it 'says hello to Jeff' do
hello = Hello.new
result = hello.greet("Jeff")
expe... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | problem-solving/spec/character_count_spec.rb | Ruby | mit | 237 | main | 653 | RSpec.describe 'character count' do
it 'can count a small word' do
cc = CharacterCount.new
result = cc.count("test")
expected = 4
expect(result).to eq(expected)
end
it 'can count another word' do
cc = CharacterCount.new
result = cc.count("pterodactyl")
expected = 11
expect(re... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | problem-solving/spec/simple_math_spec.rb | Ruby | mit | 237 | main | 1,159 | require "./lib/simple_math"
RSpec.describe SimpleMath do
it 'can add two numbers' do
sm = SimpleMath.new
result = sm.add(2,2)
expected = 4
expect(result).to eq(expected)
end
it 'can add two different numbers' do
sm = SimpleMath.new
result = sm.add(5,3)
expected = 8
expect(re... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | objects-and-methods/exercise-1/spec/bag_spec.rb | Ruby | mit | 237 | main | 1,407 | require 'rspec'
require_relative '../lib/bag'
require_relative '../lib/candy'
RSpec.describe Bag do
it 'is empty' do
expect(Bag.new.empty?).to be true
end
xit 'can count the candy in an empty bag' do
expect(Bag.new.count).to eq(0)
end
xit 'has no candies when it is empty' do
expect(Bag.new.cand... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | objects-and-methods/exercise-1/spec/trick_or_treater_spec.rb | Ruby | mit | 237 | main | 1,896 | require 'rspec'
require_relative '../lib/costume'
require_relative '../lib/bag'
require_relative '../lib/candy'
require_relative '../lib/trick_or_treater'
RSpec.describe TrickOrTreater do
it 'wears a costume' do
costume = Costume.new('Cowboy')
trick_or_treater = TrickOrTreater.new(costume)
expect(trick_o... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | objects-and-methods/exercise-1/spec/candy_spec.rb | Ruby | mit | 237 | main | 304 | require 'rspec'
require_relative '../lib/candy'
RSpec.describe Candy do
it 'has a type' do
candy = Candy.new('Skittles')
expect(candy.type).to eq('Skittles')
end
xit 'has a different kind of candy' do
candy = Candy.new('Snickers')
expect(candy.type).to eq('Snickers')
end
end |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | objects-and-methods/exercise-1/spec/costume_spec.rb | Ruby | mit | 237 | main | 322 | require 'rspec'
require_relative '../lib/costume'
RSpec.describe Costume do
it 'has a style' do
costume = Costume.new('Dragon')
expect(costume.style).to eq('Dragon')
end
xit 'has a different style of costume' do
costume = Costume.new('Princess')
expect(costume.style).to eq('Princess')
end
en... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | objects-and-methods/exercise-2/spec/bag_spec.rb | Ruby | mit | 237 | main | 2,419 | require 'rspec'
require_relative '../lib/bag'
require_relative '../lib/candy'
RSpec.describe Bag do
it 'is empty' do
expect(Bag.new.empty?).to be true
end
xit 'can count the candy in an empty bag' do
expect(Bag.new.count).to eq(0)
end
xit 'has no candies when it is empty' do
expect(Bag.new.cand... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | objects-and-methods/exercise-2/spec/candy_spec.rb | Ruby | mit | 237 | main | 550 | require 'rspec'
require_relative '../lib/candy'
RSpec.describe Candy do
it 'has a type' do
candy = Candy.new('Skittles')
expect(candy.type).to eq('Skittles')
end
xit 'can have a different type' do
candy = Candy.new('Mars')
expect(candy.type).to eq('Mars')
end
xit 'has 100g of sugar by def... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | objects-and-methods/exercise-2/spec/trick_or_treater_spec.rb | Ruby | mit | 237 | main | 2,497 | require 'rspec'
require_relative '../lib/costume'
require_relative '../lib/bag'
require_relative '../lib/candy'
require_relative '../lib/trick_or_treater'
RSpec.describe TrickOrTreater do
it 'wears a costume' do
costume = Costume.new('Cowboy')
trick_or_treater = TrickOrTreater.new(costume)
expect(trick_o... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | mythical-creatures/spec/direwolf_spec.rb | Ruby | mit | 237 | main | 4,263 | require './spec/spec_helper'
require './lib/direwolf'
RSpec.describe Direwolf do
it 'has a name' do
wolf = Direwolf.new('Nymeria')
expect(wolf.name).to eq('Nymeria')
end
it 'can have a different name and can have a home' do
wolf = Direwolf.new('Lady')
expect(wolf.home).to eq('Beyond the Wall')... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | mythical-creatures/spec/werewolf_spec.rb | Ruby | mit | 237 | main | 1,809 | require 'rspec'
require './lib/werewolf'
RSpec.describe Werewolf do
it 'has a name' do
werewolf = Werewolf.new('David')
expect(werewolf.name).to eq('David')
end
it 'has a location' do
werewolf = Werewolf.new('David', 'London')
expect(werewolf.location).to eq('London')
end
it 'is by default ... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | mythical-creatures/spec/pirate_spec.rb | Ruby | mit | 237 | main | 1,111 | require 'rspec'
require './lib/pirate'
RSpec.describe Pirate do
it 'has a name' do
pirate = Pirate.new('Jane')
expect(pirate.name).to eq('Jane')
end
it 'can have a different name' do
pirate = Pirate.new('Blackbeard')
expect(pirate.name).to eq('Blackbeard')
end
it 'is a scallywag by default'... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | mythical-creatures/spec/lovisa_spec.rb | Ruby | mit | 237 | main | 1,015 | require 'rspec'
require './lib/lovisa'
RSpec.describe Lovisa do
it 'she has a title' do
lovisa = Lovisa.new('Lovisa the Swedish Goddess')
expect(lovisa.title).to eq('Lovisa the Swedish Goddess')
end
it 'she is brilliant by default' do
lovisa = Lovisa.new('Lovisa the Mentor')
expect(lovisa.charac... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | mythical-creatures/spec/dragon_spec.rb | Ruby | mit | 237 | main | 1,222 | require 'rspec'
require './lib/dragon'
RSpec.describe Dragon do
it 'has a name' do
dragon = Dragon.new('Ramoth', :gold, 'Lessa')
expect(dragon.name).to eq('Ramoth')
end
it 'has a rider' do
dragon = Dragon.new('Ramoth', :gold, 'Lessa')
expect(dragon.rider).to eq('Lessa')
end
it 'has a color'... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | mythical-creatures/spec/ogre_spec.rb | Ruby | mit | 237 | main | 2,025 | require './spec/spec_helper'
require './lib/ogre'
RSpec.describe Ogre do
it 'has a name' do
ogre = Ogre.new('Brak')
expect(ogre.name).to eq('Brak')
end
it 'lives somewhere by default' do
ogre = Ogre.new('Brak')
expect(ogre.home).to eq('Swamp')
end
it 'doesnt have to live in a swamp' do
... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | mythical-creatures/spec/medusa_spec.rb | Ruby | mit | 237 | main | 1,008 | require 'rspec'
require './lib/medusa'
RSpec.describe Medusa do
it 'has a name' do
medusa = Medusa.new('Cassiopeia')
expect(medusa.name).to eq('Cassiopeia')
end
it 'has no statues when created' do
medusa = Medusa.new('Cassiopeia')
expect(medusa.statues).to be_empty
end
it 'gains a statue wh... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | mythical-creatures/spec/unicorn_spec.rb | Ruby | mit | 237 | main | 824 | require 'rspec'
require './lib/unicorn'
RSpec.describe Unicorn do
it 'has a name' do
unicorn = Unicorn.new('Robert')
expect(unicorn.name).to eq('Robert')
end
it 'is silver by default' do
unicorn = Unicorn.new('Margaret')
expect(unicorn.color).to eq('silver')
expect(unicorn.silver?).to eq(tru... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | mythical-creatures/spec/centaur_spec.rb | Ruby | mit | 237 | main | 2,960 | require './spec/spec_helper'
require './lib/centaur'
RSpec.describe Centaur do
it 'has a name' do
centaur = Centaur.new('George', 'Palomino')
expect(centaur.name).to eq('George')
end
it 'has a horse breed' do
centaur = Centaur.new('George', 'Palomino')
expect(centaur.breed).to eq('Palomino')
e... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | mythical-creatures/spec/wizard_spec.rb | Ruby | mit | 237 | main | 1,195 | require 'rspec'
require './lib/wizard'
RSpec.describe Wizard do
it 'has a name' do
wizard = Wizard.new('Eric')
expect(wizard.name).to eq('Eric')
end
it 'has a different name' do
wizard = Wizard.new('Alex')
expect(wizard.name).to eq('Alex')
end
it 'is bearded by default' do
wizard = Wiza... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | mythical-creatures/spec/vampire_spec.rb | Ruby | mit | 237 | main | 812 | require 'rspec'
require './lib/vampire'
RSpec.describe Vampire do
it 'has a name' do
vampire = Vampire.new('Dracula')
expect(vampire.name).to eq('Dracula')
end
it 'it can be named something else' do
vampire = Vampire.new('Vladimir')
expect(vampire.name).to eq('Vladimir')
end
it 'keeps a pet... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | mythical-creatures/spec/hobbit_spec.rb | Ruby | mit | 237 | main | 1,707 | require './spec/spec_helper'
require './lib/hobbit'
RSpec.describe Hobbit do
it 'has a name' do
hobbit = Hobbit.new('Bilbo')
expect(hobbit.name).to eq('Bilbo')
end
it 'can have another name' do
hobbit = Hobbit.new('Peregrin')
expect(hobbit.name).to eq('Peregrin')
end
it 'has an unadventurou... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/count_pattern_spec.rb | Ruby | mit | 237 | main | 1,331 | RSpec.describe 'Count Pattern Test' do
it 'counts words with an e' do
words = ["thing", "phone", "bark", "belt", "shoe", "bath"]
tally = 0
words.each do |word|
tally += 1 if word.include?('e')
end
expect(tally).to eq(3)
end
xit 'counts numbers greater than 17' do
numbers = [9, 18, ... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/find_spec.rb | Ruby | mit | 237 | main | 1,646 | RSpec.describe 'find test' do
it 'first seven letter word' do
words = ["capricious", "berry", "unicorn", "bag", "apple", "festering", "pretzel", "pencil"]
found = words.find do |word|
word.length == 7
end
expect(found).to eq("unicorn")
end
xit 'no waldo' do
words = ["scarf", "sandcastl... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/map_spec.rb | Ruby | mit | 237 | main | 1,418 | RSpec.describe 'map' do
it 'capitalizes' do
names = ["alice", "bob", "charlie"]
capitalized_names = names.map do |name|
name.capitalize
end
expect(capitalized_names).to eq(["Alice", "Bob", "Charlie"])
end
xit 'doubles' do
numbers = [1, 2, 3, 4, 5]
doubles = numbers.map do |number|
... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/basic_enums_spec.rb | Ruby | mit | 237 | main | 275 | RSpec.describe 'Basic Enums Test' do
it 'solve for x' do
s = ''
5.times do
# write code here
end
expect(s).to eq('xxxxx')
end
xit 'simple sum' do
sum = 0
numbers = [1, 2, 3, 4, 5]
# write code here
expect(sum).to eq(15)
end
end |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/find_pattern_spec.rb | Ruby | mit | 237 | main | 1,730 | RSpec.describe 'find pattern' do
it 'finds first seven letter word' do
words = ["capricious", "berry", "unicorn", "bag", "apple", "festering", "pretzel", "pencil"]
found = nil
words.each do |word|
if word.length == 7
found = word
break
end
end
expect(found).to eq("unic... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/any_spec.rb | Ruby | mit | 237 | main | 1,165 | RSpec.describe 'Any test' do
it 'has at least one zero' do
numbers = [2, 0, 9, 3, 0, 1]
has_zero = numbers.any? do |number|
number.zero?
end
expect(has_zero).to eq(true)
end
xit 'does not have zeroes' do
numbers = [3, 1, 3, 2, 4, 9, 8]
has_zero = numbers.any? do |number|
# You... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/any_pattern_spec.rb | Ruby | mit | 237 | main | 1,251 | RSpec.describe 'Any Pattern Test' do
it 'has at least one zero' do
numbers = [2, 0, 9, 3, 0, 1]
has_zero = false
numbers.each do |number|
has_zero = true if number.zero?
end
expect(has_zero).to eq(true)
end
xit 'does not have any zeros' do
numbers = [3, 1, 3, 2, 4, 9, 8]
has_ze... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/reject_pattern_spec.rb | Ruby | mit | 237 | main | 3,111 | RSpec.describe 'reject pattern' do
it 'removes zeroes' do
numbers = [2, 93, 7, 0, 0, 1, 0, 31, 0, 368]
filtered = []
numbers.each do |number|
filtered << number unless number.zero?
end
expect(filtered).to eq([2, 93, 7, 1, 31, 368])
end
xit 'removes vowels' do
letters = ["a", "l", "... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/map_pattern_spec.rb | Ruby | mit | 237 | main | 1,479 | RSpec.describe 'map pattern' do
it 'capitalizes' do
names = ["alice", "bob", "charlie"]
capitalized_names = []
names.each do |name|
capitalized_names << name.capitalize
end
expect(capitalized_names).to eq(["Alice", "Bob", "Charlie"])
end
xit 'doubles' do
numbers = [1, 2, 3, 4, 5]
... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/one_spec.rb | Ruby | mit | 237 | main | 1,081 | RSpec.describe 'one' do
it 'one more' do
words = ["bigger", "better", "more", "improved", "advantageous"]
exactly_one = words.one? do |word|
word == 'more'
end
expect(exactly_one).to eq(true)
end
xit 'not even one ring' do
ornaments = ["bracelet", "anklet", "earring"]
exactly_one_r... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/reject_spec.rb | Ruby | mit | 237 | main | 3,033 | RSpec.describe 'reject' do
it 'removes zeroes' do
numbers = [2, 93, 7, 0, 0, 1, 0, 31, 0, 368]
filtered = numbers.reject do |number|
number.zero?
end
expect(filtered).to eq([2, 93, 7, 1, 31, 368])
end
xit 'removes vowels' do
letters = ["a", "l", "l", " ", "y", "o", "u", "r", " ", "b", ... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/reduce_pattern_spec.rb | Ruby | mit | 237 | main | 1,304 | RSpec.describe 'reduce pattern' do
it 'sums a list of numbers' do
numbers = [32, 1, 21, 5, 81, 333]
sum = 0
numbers.each do |number|
sum = sum + number
end
expect(sum).to eq(473)
end
xit 'subtracts a list of numbers' do
numbers = [28, 12, 38, 1, 91]
difference = 0
numbers.ea... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/count_spec.rb | Ruby | mit | 237 | main | 1,268 | RSpec.describe 'count test' do
it 'words with e' do
words = ["thing", "phone", "bark", "belt", "shoe", "bath"]
tally = words.count do |word|
word.include?('e')
end
expect(tally).to eq(3)
end
xit 'numbers greater than 17' do
numbers = [9, 18, 12, 17, 1, 3, 99]
tally = numbers.count ... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/group_by_pattern_spec.rb | Ruby | mit | 237 | main | 1,971 | RSpec.describe 'group by pattern' do
it 'group words by length' do
words = ["sue", "alice", "steve", "sally", "adam", "fort", "tops", "dog", "cat"]
grouped = Hash.new {|hash, key| hash[key] = []}
words.each do |word|
grouped[word.length] << word
end
expected = {3=>["sue", "dog", "cat"], 4=>... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/group_by_spec.rb | Ruby | mit | 237 | main | 1,803 | RSpec.describe 'group by' do
it 'groups words by length' do
words = ["sue", "alice", "steve", "sally", "adam", "fort", "tops", "dog", "cat"]
grouped = words.group_by do |word|
word.length
end
expected = {3=>["sue", "dog", "cat"], 4=>["adam", "fort", "tops"], 5=>["alice", "steve", "sally"]}
e... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/none_pattern_spec.rb | Ruby | mit | 237 | main | 1,115 | RSpec.describe 'none pattern' do
it 'none are broken' do
things = ["functional", "working", "works", "fixed", "good"]
none_broken = true
things.each do |thing|
none_broken = false if thing == "broken"
end
expect(none_broken).to eq(true)
end
xit 'double negative' do
numbers = [9, 3,... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/zip_pattern_spec.rb | Ruby | mit | 237 | main | 1,571 | RSpec.describe 'zip pattern' do
it 'speed interview pairs' do
list1 = ["Alice", "Bob", "Charlie"]
list2 = ["Xenia", "Yves", "Zach"]
pairs = []
list1.length.times do |i|
pairs << [list1[i], list2[i]]
end
expect(pairs).to eq([["Alice", "Xenia"], ["Bob", "Yves"], ["Charlie", "Zach"]])
en... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/zip_spec.rb | Ruby | mit | 237 | main | 1,435 | RSpec.describe 'zip' do
it 'speed interview pairs' do
list1 = ["Alice", "Bob", "Charlie"]
list2 = ["Xenia", "Yves", "Zach"]
pairs = list1.zip(list2)
expect(pairs).to eq([["Alice", "Xenia"], ["Bob", "Yves"], ["Charlie", "Zach"]])
end
xit 'test menu' do
list1 = ["NY Strip Steak", "Lamb Stew", ... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/sort_by_pattern_spec.rb | Ruby | mit | 237 | main | 1,716 | RSpec.describe 'sort_by pattern' do
it 'sorts alphabetically' do
words = ["broccoli", "Carrots", "FISH", "Bacon", "candy"]
transformed = []
words.each do |word|
transformed << [word.downcase, word]
end
transformed = transformed.sort
sorted = []
transformed.each do |sort_key, word|
... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/select_spec.rb | Ruby | mit | 237 | main | 2,164 | RSpec.describe 'select' do
it 'even numbers' do
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
evens = numbers.select do |number|
number.even?
end
expect(evens).to eq([2, 4, 6, 8, 10])
end
xit 'odd numbers' do
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
odds = numbers.select do |number|
... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/find_using_max_by_spec.rb | Ruby | mit | 237 | main | 1,690 | RSpec.describe 'max_by' do
# You get the first test for free... it's already passing.
it 'longest word' do
words = ["apple", "banana", "cherry", "date", "eggplant"]
found_word = words.max_by do |word|
word.length
end
expect(found_word).to eq("eggplant")
end
# This one is missing the blo... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/select_pattern_spec.rb | Ruby | mit | 237 | main | 2,230 | RSpec.describe 'select pattern' do
it 'picks even numbers' do
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
evens = []
numbers.each do |number|
evens << number if number.even?
end
expect(evens).to eq([2, 4, 6, 8, 10])
end
xit 'picks odd numbers' do
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9,... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/none_spec.rb | Ruby | mit | 237 | main | 1,043 | RSpec.describe 'none' do
it 'none are broken' do
things = ["functional", "working", "works", "fixed", "good"]
none_broken = things.none? do |thing|
thing == "broken"
end
expect(none_broken).to eq(true)
end
xit 'double negative' do
numbers = [9, 3, 3, 7, 6, -5, 1]
not_none_negative ... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/all_spec.rb | Ruby | mit | 237 | main | 1,739 | RSpec.describe 'all test' do
it 'test all zeroes' do
numbers = [0, 0, 0, 0, 0, 0, 0]
all_zeros = numbers.all? do |number|
number.zero?
end
expect(all_zeros).to eq(true)
end
xit 'not all zeroes' do
numbers = [0, 0, 0, 0, 1, 0, 0, 0]
all_zeros = numbers.all? do |number|
# Your c... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/all_pattern_spec.rb | Ruby | mit | 237 | main | 1,797 | RSpec.describe 'All Pattern' do
it 'all zeros' do
numbers = [0, 0, 0, 0, 0, 0, 0]
all_zeros = true
numbers.each do |number|
all_zeros = false unless number.zero?
end
expect(all_zeros).to eq(true)
end
xit 'not all zeros' do
numbers = [0, 0, 0, 0, 1, 0, 0, 0]
all_zeros = true
... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/sort_by_spec.rb | Ruby | mit | 237 | main | 1,250 | RSpec.describe 'sort_by' do
it 'alphabetically' do
words = ["broccoli", "Carrots", "FISH", "Bacon", "candy"]
sorted = words.sort_by do |word|
word.downcase
end
expect(sorted).to eq(["Bacon", "broccoli", "candy", "Carrots", "FISH"])
end
xit 'alphabetically by last letter' do
things = ["... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/reduce_spec.rb | Ruby | mit | 237 | main | 1,343 | RSpec.describe 'reduce' do
it 'sums a list of numbers' do
numbers = [32, 1, 21, 5, 81, 333]
result = numbers.reduce(0) do |sum, number|
sum + number
end
expect(result).to eq(473)
end
xit 'subtracts a list of numbers' do
numbers = [28, 12, 38, 1, 91]
result = numbers.reduce(0) do |d... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | enumerables/exercises_1/spec/one_pattern_spec.rb | Ruby | mit | 237 | main | 1,326 | RSpec.describe 'one pattern' do
it 'one more' do
words = ["bigger", "better", "more", "improved", "advantageous"]
count = 0
words.each do |word|
count += 1 if word == 'more'
end
exactly_one = count == 1
expect(exactly_one).to eq(true)
end
xit 'not even one ring' do
ornaments = ... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | data-types/collections/spec/nested_collections_spec.rb | Ruby | mit | 237 | main | 8,222 | RSpec.describe 'Nested Collections' do
it 'test 1' do
coordinates = [[2,5],[87,2],[56,39],[3,46]]
# Using the coordinates variable defined above
# Retrive the second element
second = coordinates[1]
expect(second).to eq([87, 2])
end
xit 'test 2' do
coordinates = [[2,5],[87,2],[56,39],[3,4... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | data-types/collections/spec/hashes_spec.rb | Ruby | mit | 237 | main | 6,074 | RSpec.describe 'Hashes' do
it 'test 1' do
# In the line below, create a new empty hash called empty
empty = ______
expect(empty).to eq({})
end
xit 'test 2' do
# In the line below, create an empty hash with a default value 0
empty = ______
expect(empty[:not_found]).to eq(0)
end
xit 't... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | data-types/collections/spec/arrays_spec.rb | Ruby | mit | 237 | main | 5,645 | RSpec.describe 'Arrays' do
it 'test 0' do
# in the line below, create a new empty array
empty = ______
expect(empty).to eq([])
end
xit 'test 1' do
# in the line below, create an array with the numbers 1 through 5
nums = _____
expect(nums).to eq([1,2,3,4,5])
end
xit 'test 2' do
... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | data-types/collections/advanced_nested_collections/spec/advanced_nesting_spec.rb | Ruby | mit | 237 | main | 3,936 | require_relative 'nesting'
# The intent of this exercise is to practice working with nested collections.
# Some tests will be able to pass without any enumeration, and others will require
# more complex iteration over multiple portions of the nested collection.
# All tests can be completed without using any enumerabl... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | data-types/collections/advanced_nested_collections/spec/nesting.rb | Ruby | mit | 237 | main | 1,408 | def stores
{
olive_garden: {
employees: [
'Jeff',
'Zach',
'Samantha'
],
dishes: [
{
name: 'Risotto',
ingredients: [
'Rice',
'Cheese',
'Butter'
],
price: 12
},
{
... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | data-types/strings/spec/strings_spec.rb | Ruby | mit | 237 | main | 5,465 | RSpec.describe 'Strings' do
it 'test 1' do
name = "alice"
# In place of the line below, call a method on the name variable
# defined above to acheive the expected output.
actual = name._____
expected = "Alice"
expect(actual).to eq(expected)
end
xit 'test 2' do
name = "aLiCe"
# In... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | data-types/ints_and_floats/spec/ints_and_floats_spec.rb | Ruby | mit | 237 | main | 1,804 | RSpec.describe 'ints and floats' do
it 'test 1' do
lucky = 7
unlucky = 13
# Using the two variables defined above,
# add the lucky number and the unlucky number
sum = ________
expect(sum).to eq(20)
end
xit 'test 2' do
lucky = 7
unlucky = 13
# Using the two variables defined ab... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | iteration/exercises/spec/map_pattern_spec.rb | Ruby | mit | 237 | main | 2,595 | RSpec.describe 'map pattern' do
it 'test 1' do
names = ["alice", "bob", "charlie"]
capitalized_names = []
names.each do |name|
capitalized_names << name.capitalize
end
expect(capitalized_names).to eq(["Alice", "Bob", "Charlie"])
end
xit 'test 2' do
family = {
mother: "alice",... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | iteration/exercises/spec/select_pattern_spec.rb | Ruby | mit | 237 | main | 2,878 | RSpec.describe 'select pattern' do
it 'test 1' do
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
evens = []
numbers.each do |number|
evens << number if number.even?
end
expect(evens).to eq([2, 4, 6, 8, 10])
end
it 'test 2' do
numbers = {
one: 1,
two: 2,
three: 3,
... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | iteration/exercises/spec/max_and_min_by_pattern_spec.rb | Ruby | mit | 237 | main | 2,278 | RSpec.describe 'max and min by pattern' do
it 'test 1' do
numbers = [1, 100, 1000, 1000000]
greatest = numbers[0]
numbers.each do |number|
if number > greatest
greatest = number
end
end
expect(greatest).to eq(1000000)
end
it 'test 2' do
magnitudes = {
ones: 1,
... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | iteration/exercises/spec/inject_pattern_spec.rb | Ruby | mit | 237 | main | 4,146 | RSpec.describe 'inject pattern test' do
it 'test 1' do
numbers = [28, 12, 38, 1, 91]
# Iterate over the numbers array defined above,
# to find the difference of all the numbers
difference = 0
numbers.each do |number|
difference = difference - number
end
expect(difference).to eq(-170... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | iteration/exercises/spec/count_pattern_spec.rb | Ruby | mit | 237 | main | 2,079 | RSpec.describe 'count pattern' do
it 'test 1' do
ages = [39, 45, 29, 24, 50]
younger_than_thirty = 0
ages.each do |age|
if age < 30
younger_than_thirty += 1
end
end
expect(younger_than_thirty).to eq(2)
end
xit 'test 2' do
ages = {
abdi: 39,
hassan: 45,
... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | iteration/exercises/spec/group_by_pattern_spec.rb | Ruby | mit | 237 | main | 1,931 | RSpec.describe 'group by pattern' do
it 'by word length' do
words = ["sue", "alice", "steve", "sally", "adam", "fort", "tops", "dog", "cat"]
grouped = Hash.new {|hash, key| hash[key] = []}
words.each do |word|
grouped[word.length] << word
end
expected = {3=>["sue", "dog", "cat"], 4=>["adam"... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | iteration/exercises/spec/all_pattern_spec.rb | Ruby | mit | 237 | main | 2,143 | RSpec.describe 'all pattern' do
it 'test 1' do
account_balances = [0, 0, 0, 0, 0, 0, 0]
all_zeros = true
account_balances.each do |balance|
all_zeros = false unless balance.zero?
end
expect(all_zeros).to be true
end
it 'test 2' do
account_balances = {
checking: 0,
saving... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | iteration/exercises/spec/find_pattern_spec.rb | Ruby | mit | 237 | main | 2,412 | RSpec.describe 'find pattern' do
it 'test 1' do
ages = [39, 45, 29, 24, 50]
younger_than_thirty = nil
ages.each do |age|
if age < 30
younger_than_thirty = age
break
end
end
expect(younger_than_thirty).to eq(29)
end
it 'test 2' do
ages = {
abdi: 39,
... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | initialize/spec/cat_spec.rb | Ruby | mit | 237 | main | 373 | require 'rspec'
require_relative '../lib/cat'
RSpec.describe Cat do
it 'exists' do
carlos = Cat.new("Carlos")
expect(carlos).to be_an_instance_of(Cat)
end
it 'has a name' do
carlos = Cat.new("Carlos")
expect(carlos.name).to eq("Carlos")
end
it 'has a sound' do
carlos = Cat.new("Carlos... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | initialize/spec/horse_spec.rb | Ruby | mit | 237 | main | 566 | require 'rspec'
require_relative '../lib/horse'
RSpec.describe Horse do
it 'exists' do
harry = Horse.new("Harry")
expect(harry).to be_an_instance_of(Horse)
end
it 'has a name' do
harry = Horse.new("Harry")
expect(harry.name).to eq("Harry")
end
it 'starts with empty diet' do
harry = Ho... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | initialize/spec/kangaroo_spec.rb | Ruby | mit | 237 | main | 345 | require 'rspec'
require_relative '../lib/kangaroo'
RSpec.describe Kangaroo do
it 'exists' do
kerrie = Kangaroo.new("Kerrie", ["Kat", "Kyle"])
expect(kerrie).to be_an_instance_of(Kangaroo)
end
it 'has children' do
kerrie = Kangaroo.new("Kerrie", ["Kat", "Kyle"])
expect(kerrie.children).to eq(["... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | initialize/spec/narwhal_spec.rb | Ruby | mit | 237 | main | 852 | require 'rspec'
require_relative '../lib/narwhal'
RSpec.describe Narwhal do
it 'exists' do
nancy = Narwhal.new({cute: true, weight: 500, name: "Nancy"})
expect(nancy).to be_an_instance_of(Narwhal)
end
it 'has a name' do
nancy = Narwhal.new({cute: true, weight: 500, name: "Nancy"})
expect(nancy... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | initialize/spec/beaver_spec.rb | Ruby | mit | 237 | main | 431 | require 'rspec'
require_relative '../lib/beaver'
RSpec.describe Beaver do
it 'exists' do
barry = Beaver.new("Barry")
expect(barry).to be_an_instance_of(Beaver)
end
it 'has a name' do
barry = Beaver.new("Barry")
expect(barry.name).to eq("Barry the Beaver")
end
it 'could have a different na... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | initialize/spec/jackalope_spec.rb | Ruby | mit | 237 | main | 445 | require 'rspec'
require_relative '../lib/jackalope'
RSpec.describe Jackalope do
it 'exists' do
jorge = Jackalope.new("Jorge")
expect(jorge).to be_an_instance_of(Jackalope)
end
it 'has a name' do
jorge = Jackalope.new("Jorge")
expect(jorge.name).to eq("Jorge")
end
it 'starts with an array ... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | initialize/spec/monkey_spec.rb | Ruby | mit | 237 | main | 631 | require 'rspec'
require_relative '../lib/monkey'
RSpec.describe Monkey do
it 'exists' do
margaret = Monkey.new(["Margaret", "Bonobo", "Bananas"])
expect(margaret).to be_an_instance_of(Monkey)
end
it 'has a name' do
margaret = Monkey.new(["Margaret", "Bonobo", "Bananas"])
expect(margaret.name).... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | initialize/spec/aardvark_spec.rb | Ruby | mit | 237 | main | 277 | require 'rspec'
require_relative '../lib/aardvark'
RSpec.describe Aardvark do
it 'exists' do
art = Aardvark.new("Art")
expect(art).to be_an_instance_of(Aardvark)
end
it 'has a name' do
art = Aardvark.new("Art")
expect(art.name).to eq("Art")
end
end |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | initialize/spec/octopus_spec.rb | Ruby | mit | 237 | main | 860 | require 'rspec'
require_relative '../lib/eel'
require_relative '../lib/narwhal'
require_relative '../lib/octopus'
RSpec.describe Octopus do
it 'exists' do
nancy = Narwhal.new({cute: true, weight: 500, name: "Nancy"})
orville = Octopus.new("Orville", nancy)
expect(orville).to be_an_instance_of(Octopus)
... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | initialize/spec/groundhog_spec.rb | Ruby | mit | 237 | main | 438 | require 'rspec'
require_relative '../lib/groundhog'
RSpec.describe Groundhog do
it 'exists' do
gabby = Groundhog.new("Gabby")
expect(gabby).to be_an_instance_of(Groundhog)
end
it 'has a name' do
gabby = Groundhog.new("Gabby")
expect(gabby.name).to eq("Gabby")
end
it 'can change name' do
... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | initialize/spec/quail_spec.rb | Ruby | mit | 237 | main | 388 | require 'rspec'
require_relative '../lib/quail'
RSpec.describe Quail do
it 'exists' do
quinn = Quail.new("Quinn")
expect(quinn).to be_an_instance_of(Quail)
end
it 'has a name' do
quinn = Quail.new("Quinn")
expect(quinn.name).to eq("Quinn")
end
it 'will capitalize its name' do
quinn = ... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | initialize/spec/iguana_spec.rb | Ruby | mit | 237 | main | 438 | require 'rspec'
require_relative '../lib/iguana'
RSpec.describe Iguana do
it 'exists' do
iguana = Iguana.new
expect(iguana).to be_an_instance_of(Iguana)
end
it 'starts with no colors' do
iguana = Iguana.new
expect(iguana.colors).to eq([])
end
it 'can set colors' do
iguana = Iguana.new... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | initialize/spec/ferret_spec.rb | Ruby | mit | 237 | main | 396 | require 'rspec'
require_relative '../lib/ferret'
RSpec.describe Ferret do
it 'exists' do
ferret = Ferret.new
expect(ferret).to be_an_instance_of(Ferret)
end
it 'has no name' do
ferret = Ferret.new
expect(ferret.name).to eq(nil)
end
it 'can be given a name' do
ferret = Ferret.new
... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | initialize/spec/dog_spec.rb | Ruby | mit | 237 | main | 484 | require 'rspec'
require_relative '../lib/dog'
RSpec.describe Dog do
it 'exists' do
doug = Dog.new("Doug", "Golden Retriever")
expect(doug).to be_an_instance_of(Dog)
end
it 'has a greeting' do
doug = Dog.new("Doug", "Golden Retriever")
expect(doug.greeting).to eq("Woof, I'm Doug the Golden Retr... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | initialize/spec/lion_spec.rb | Ruby | mit | 237 | main | 448 | require 'rspec'
require_relative '../lib/lion'
RSpec.describe Lion do
it 'exists' do
lionel = Lion.new({name: "Lionel", sound: "roar"})
expect(lionel).to be_an_instance_of(Lion)
end
it 'has a name' do
lionel = Lion.new({name: "Lionel", sound: "roar"})
expect(lionel.name).to eq("Lionel")
end
... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | initialize/spec/rabbit_spec.rb | Ruby | mit | 237 | main | 687 | require 'rspec'
require_relative '../lib/rabbit'
RSpec.describe Rabbit do
it 'exists' do
ralph = Rabbit.new({name: "Ralph", num_syllables: 1})
expect(ralph).to be_an_instance_of(Rabbit)
end
it 'has a name' do
ralph = Rabbit.new({name: "Ralph", num_syllables: 1})
expect(ralph.name).to eq("Ralph... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | initialize/spec/parrot_spec.rb | Ruby | mit | 237 | main | 843 | require 'rspec'
require_relative '../lib/parrot'
RSpec.describe Parrot do
it 'exists' do
words = ["Sugar", "Flashy", "Giant", "Whisper"]
perry = Parrot.new({name: "Perry", known_words: words})
expect(perry).to be_an_instance_of(Parrot)
end
it 'has a name' do
words = ["Sugar", "Flashy", "Giant",... |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | initialize/spec/eel_spec.rb | Ruby | mit | 237 | main | 269 | require 'rspec'
require_relative '../lib/eel'
RSpec.describe Eel do
it 'exists' do
eel = Eel.new("Earl")
expect(eel).to be_an_instance_of(Eel)
end
it 'is anonymous' do
eel = Eel.new("Earl")
expect(eel.name).to eq("just another eel")
end
end |
github | turingschool-examples/ruby-exercises | https://github.com/turingschool-examples/ruby-exercises | command-query/exercises/drops_spec.rb | Ruby | mit | 237 | main | 312 | require 'rspec'
require_relative 'drops'
RSpec.describe Drops do
it 'has no drops' do
drops = Drops.new
expect(drops.count).to eq(0)
end
xit 'drips' do
drops = Drops.new
drops.drip
expect(drops.count).to eq(1)
3.times { drops.drip }
expect(drops.count).to eq(4)
end
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.