Skip to content

Instantly share code, notes, and snippets.

/macbeth_spec.rb Secret

Created October 25, 2016 02:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/f84a40407bf79f566b6104e41f3908c8 to your computer and use it in GitHub Desktop.
Save anonymous/f84a40407bf79f566b6104e41f3908c8 to your computer and use it in GitHub Desktop.
require 'macbeth_analyzer'
describe MacbethAnalyzer do
describe "#analyze" do
it "correctly analyzes character line counts" do
macbeth_line_counts = {
"First Witch": 62,
"Second Witch": 27,
"Third Witch": 27,
"ALL": 24,
"DUNCAN": 70,
"MALCOLM": 212,
"Sergeant": 35,
"LENNOX": 74,
"ROSS": 135,
"MACBETH": 719,
"BANQUO": 113,
"ANGUS": 21,
"LADY MACBETH": 265,
"Messenger": 23,
"FLEANCE": 2,
"Porter": 46,
"MACDUFF": 180,
"DONALBAIN": 10,
"Old Man": 11,
"ATTENDANT": 1,
"First Murderer": 30,
"Second Murderer": 15,
"Both Murderers": 2,
"Servant": 5,
"Third Murderer": 8,
"Lords": 3,
"HECATE": 39,
"Lord": 21,
"First Apparition": 2,
"Second Apparition": 4,
"Third Apparition": 5,
"LADY MACDUFF": 41,
"Son": 20,
"Doctor": 45,
"Gentlewoman": 23,
"MENTEITH": 12,
"CAITHNESS": 11,
"SEYTON": 5,
"SIWARD": 30,
"Soldiers": 1,
"YOUNG SIWARD": 7
}
macbeth = MacbethAnalyzer.new
result = macbeth.analyze
expect(result).to eq(macbeth_line_counts)
end
end
end
Failures:
1) MacbethAnalyzer#analyze correctly analyzes character line counts
Failure/Error: expect(result).to eq(macbeth_line_counts)
expected: {:"First Witch"=>62, :"Second Witch"=>27, :"Third Witch"=>27, :ALL=>24, :DUNCAN=>70, :MALCOLM=>212, :...woman=>23, :MENTEITH=>12, :CAITHNESS=>11, :SEYTON=>5, :SIWARD=>30, :Soldiers=>1, :"YOUNG SIWARD"=>7}
got: {"First Witch"=>62, "Second Witch"=>27, "Third Witch"=>27, "ALL"=>24, "DUNCAN"=>70, "MALCOLM"=>212, "..."=>23, "MENTEITH"=>12, "CAITHNESS"=>11, "SEYTON"=>5, "SIWARD"=>30, "Soldiers"=>1, "YOUNG SIWARD"=>7}
(compared using ==)
Diff:
@@ -1,42 +1,42 @@
-:"Both Murderers" => 2,
-:"First Apparition" => 2,
-:"First Murderer" => 30,
-:"First Witch" => 62,
-:"LADY MACBETH" => 265,
-:"LADY MACDUFF" => 41,
-:"Old Man" => 11,
-:"Second Apparition" => 4,
-:"Second Murderer" => 15,
-:"Second Witch" => 27,
-:"Third Apparition" => 5,
-:"Third Murderer" => 8,
-:"Third Witch" => 27,
-:"YOUNG SIWARD" => 7,
-:ALL => 24,
-:ANGUS => 21,
-:ATTENDANT => 1,
-:BANQUO => 113,
-:CAITHNESS => 11,
-:DONALBAIN => 10,
-:DUNCAN => 70,
-:Doctor => 45,
-:FLEANCE => 2,
-:Gentlewoman => 23,
-:HECATE => 39,
-:LENNOX => 74,
-:Lord => 21,
-:Lords => 3,
-:MACBETH => 719,
-:MACDUFF => 180,
-:MALCOLM => 212,
-:MENTEITH => 12,
-:Messenger => 23,
-:Porter => 46,
-:ROSS => 135,
-:SEYTON => 5,
-:SIWARD => 30,
-:Sergeant => 35,
-:Servant => 5,
-:Soldiers => 1,
-:Son => 20,
+"ALL" => 24,
+"ANGUS" => 21,
+"ATTENDANT" => 1,
+"BANQUO" => 113,
+"Both Murderers" => 2,
+"CAITHNESS" => 11,
+"DONALBAIN" => 10,
+"DUNCAN" => 70,
+"Doctor" => 45,
+"FLEANCE" => 2,
+"First Apparition" => 2,
+"First Murderer" => 30,
+"First Witch" => 62,
+"Gentlewoman" => 23,
+"HECATE" => 39,
+"LADY MACBETH" => 265,
+"LADY MACDUFF" => 41,
+"LENNOX" => 74,
+"Lord" => 21,
+"Lords" => 3,
+"MACBETH" => 719,
+"MACDUFF" => 180,
+"MALCOLM" => 212,
+"MENTEITH" => 12,
+"Messenger" => 23,
+"Old Man" => 11,
+"Porter" => 46,
+"ROSS" => 135,
+"SEYTON" => 5,
+"SIWARD" => 30,
+"Second Apparition" => 4,
+"Second Murderer" => 15,
+"Second Witch" => 27,
+"Sergeant" => 35,
+"Servant" => 5,
+"Soldiers" => 1,
+"Son" => 20,
+"Third Apparition" => 5,
+"Third Murderer" => 8,
+"Third Witch" => 27,
+"YOUNG SIWARD" => 7,
# ./spec/macbeth_analyzer_spec.rb:53:in `block (3 levels) in <top (required)>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment