Skip to content

Instantly share code, notes, and snippets.

@YanKozlovskiy
YanKozlovskiy / spec.rb
Created August 6, 2017 00:39
008 Spec File
require "spec_helper"
describe "Concerns::Findable" do
it "defines a module named Concerns::Findable" do
expect(defined?(Concerns::Findable)).to be_truthy
expect(Concerns::Findable).to_not be_a(Class)
expect(Concerns::Findable).to be_a(Module)
end
end
Song
#initialize
accepts a name for the new song
#name
retrieves the name of a song
#name=
can set the name of a song
@@all
is initialized as an empty array
class Player
def initialize(name, health = 100, rank = 1)
@name = name.capitalize
@health = health
@rank = rank
end
def say_hello
"#{@name} has #{@health} health and #{@rank} rank."