This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "spec_helper" | |
| describe "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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class 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." |