title: rspec test not passing
body: <p>I'm working through the learn ruby tutorials and I'm trying pass the last example where it tests the printable method. I tested the method by calling the method directly within my ruby program and it spits out exactly whats needed. What is preventing my code from properly passing? Any help is greatly appreciated.</p>
  
  <p>Here's the rspec file:</p>
  
  <pre><code>require 'dictionary'
  
  describe Dictionary do
    before do
      @d = Dictionary.new
    end
  
    it 'is empty when created' do
      @d.entries.should == {}
    end
  
    it 'can add whole entries with keyword and definition' do
      @d.add('fish' =&gt; 'aquatic animal')
      @d.entries.should == {'fish' =&gt; 'aquatic animal'}
      @d.keywords.should == ['fish']
    end
  
    it 'add keywords (without definition)' do
      @d.add('fish')
      @d.entries.should == {'fish' =&gt; nil}
      @d.keywords.should == ['fish']
    end
  
    it 'can check whether a given keyword exists' do
      @d.include?('fish').should be_false
    end
  
    it "doesn't cheat when checking whether a given keyword exists" do
      @d.include?('fish').should be_false # if the method is empty, this test passes with nil returned
      @d.add('fish')
      @d.include?('fish').should be_true # confirms that it actually checks
      @d.include?('bird').should be_false # confirms not always returning true after add
    end
  
    it "doesn't include a prefix that wasn't added as a word in and of itself" do
      @d.add('fish')
      @d.include?('fi').should be_false
    end
  
    it "doesn't find a word in empty dictionary" do
      @d.find('fi').should be_empty # {}
    end
  
    it 'finds nothing if the prefix matches nothing' do
      @d.add('fiend')
      @d.add('great')
      @d.find('nothing').should be_empty
    end
  
    it "finds an entry" do
      @d.add('fish' =&gt; 'aquatic animal')
      @d.find('fish').should == {'fish' =&gt; 'aquatic animal'}
    end
  
    it 'finds multiple matches from a prefix and returns the entire entry (keyword + definition)' do
      @d.add('fish' =&gt; 'aquatic animal')
      @d.add('fiend' =&gt; 'wicked person')
      @d.add('great' =&gt; 'remarkable')
      @d.find('fi').should == {'fish' =&gt; 'aquatic animal', 'fiend' =&gt; 'wicked person'}
    end
  
    it 'lists keywords alphabetically' do
      @d.add('zebra' =&gt; 'African land animal with stripes')
      @d.add('fish' =&gt; 'aquatic animal')
      @d.add('apple' =&gt; 'fruit')
      @d.keywords.should == %w(apple fish zebra)
    end
  
    it 'can produce printable output like so: [keyword] "definition"' do
      @d.add('zebra' =&gt; 'African land animal with stripes')
      @d.add('fish' =&gt; 'aquatic animal')
      @d.add('apple' =&gt; 'fruit')
      @d.printable.should == %Q{[apple] "fruit"\n[fish] "aquatic animal"\n[zebra] "African land animal with stripes"}
    end
  end
  </code></pre>
  
  <p>and here's what I've created so far for the printable function:</p>
  
  <pre><code>class Dictionary
  def initialize(opts = {})
      @opts = opts
  end
  
  def entries
      @opts
  end
  
  def add(opts)
      opts.is_a?(String) ? @opts.merge!(opts =&gt; nil) : @opts.merge!(opts)
  end
  
  def keywords
      @opts.keys.sort
  end
  
  def include?(key)
      @opts.has_key?(key)
  end
  
  def find(key)
      @opts.select { |word,defin| word.scan(key).join == key }
  end
  
  def printable
      opts_sorted = @opts.sort_by { |word,defin| word}
      opts_sorted.each do |word,defin|
          print "[#{word}] \"#{defin}\"\n"
      end
  end
  end
  </code></pre>
  
  <p>and here's the error:</p>
  
  <pre><code>  1) Dictionary can produce printable output like so: [keyword] "definition"
       Failure/Error: @d.printable.should == %Q{[apple] "fruit"\n[fish] "aquatic animal
  "\n[zebra] "African land animal with stripes"}
         expected: "[apple] \"fruit\"\n[fish] \"aquatic animal\"\n[zebra] \"African lan
  d animal with stripes\""
              got: [["apple", "fruit"], ["fish", "aquatic animal"], ["zebra", "African
  land animal with stripes"]] (using ==)
         Diff:
         @@ -1,4 +1,4 @@
         -[apple] "fruit"
         -[fish] "aquatic animal"
         -[zebra] "African land animal with stripes"
         +["apple", "fruit"]
         +["fish", "aquatic animal"]
         +["zebra", "African land animal with stripes"]
       # ./11_dictionary/dictionary_spec.rb:81:in `block (2 levels) in &lt;top (required)&gt;
  '
  </code></pre>