require 'test_helper' describe SeventyEights::Record do describe "when creating a record" do before do @r = SeventyEights::Record.new("BamBam", "The Strokes", "Virginia Records", "VR666-1", URI.parse('http://example.com/test.mp3')) end it "must have the correct title" do @r.title.must_equal "BamBam" end it "must have correct artist" do @r.artist.must_equal "The Strokes" end it "must have correct label" do @r.label.must_equal "Virginia Records" end it "must have correct catalog number" do @r.catalog.must_equal "VR666-1" end it "must have correct URL" do @r.url.to_s.must_equal 'http://example.com/test.mp3' end it "must generate a sensible filename" do @r.to_filename.must_equal 'BamBam - The Strokes - Virginia Records - VR666-1.mp3' end end describe "a record with slashes in a field" do before do @r = SeventyEights::Record.new("BamBam", "The Strokes w/Bunny Boo", "Virginia Records", "VR666-1", URI.parse('http://example.com/test.mp3')) end it "must create a valid filename" do @r.to_filename.must_equal 'BamBam - The Strokes w-Bunny Boo - Virginia Records - VR666-1.mp3' end end end