This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# aretha_spec.rb | |
require_relative '../aretha.rb' #connect test to code | |
aretha = Aretha.new | |
RSpec.describe Aretha do | |
describe "#done_you_wrong!" do | |
it "ain't gonna do you wrong while you're gone" do | |
expect(aretha.done_you_wrong!).not_to be_truthy | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Aretha | |
def done_you_wrong! | |
false | |
end | |
def wanna_do_you_wrong(truth) | |
@truth = truth | |
false unless truth != "False" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Old: my_object.should_not_be_a_kind_of(Foo) | |
New: expect(my_object).not_to be_a_kind_of(Foo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rspec --help |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ gem install rspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# aretha_spec.rb | |
require_relative 'aretha.rb' #connect test to code | |
aretha = Aretha.new | |
RSpec.describe Aretha do | |
describe "#done_you_wrong!" do | |
it "ain't gonna do you wrong while you're gone" do | |
expect(aretha.done_you_wrong!).not_to be_truthy | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# require 'net/http' | |
require_relative "./key.rb" | |
require 'rest-client' | |
# require 'pry' | |
nytimes_today_json = RestClient.get("http://api.nytimes.com/svc/search/v2/articlesearch.json?callback=svc_search_v2_articlesearch&q=love&begin_date=20150811&end_date=20150811&hl=true&api-key=#{NYT}") | |
today_parsed = JSON.parse(nytimes_today_json) | |
# nytimes_20140811_json = RestClient.get("http://api.nytimes.com/svc/search/v2/articlesearch.json?callback=svc_search_v2_articlesearch&q=love&begin_date=20140811&end_date=20150811&hl=true&api-key=$NYT") | |
# 20140811_parsed = JSON.parse(nytimes_20140811_json) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Slang Expressions" != "Regular Expressions" | |
"Regular Expressions" != ["Bam!", "Aw, man!"] | |
#Give thanks for the Brolic Scholars, those Honorary Sociolinguistic Prodigies. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This method numbers the array of Hip-Hop Elements as expressed by Kool D.J. Herc and Afrikka Bambatta. | |
# Note, this does not include the 9 Refinitions established by KRS-One. Also, big love to Pebblee Poo. | |
elements = ["Breaking", "Mc'ing", "Graffiti Art", "DJ'ing", "Knowledge"] | |
def hip_hop_culture(elements) | |
elements.map.with_index(1) { |elements, idx| puts "#{idx}. #{elements}"} | |
# with_index(offset = 0) {|(*args), idx| ... } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def alias | |
# kinda colorful transformations using gsub & regexp | |
@chorus.gsub(/(wu(-|\s)tang\sclan)/i, | |
@name).gsub(/motherfucking slums/i, | |
@switchup).gsub(/fuck/i, | |
@aka).gsub(/busted/i, "trusted") | |
end |