Sha256: 5fc2b67d3188266f0fbbd1908b51091d4a66bbcce42ac6cf702faa1b2451a5e9

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'
require 'imdb/cli'

describe Imdb::CLI, "execute" do
  
  describe "yield search results" do
    before(:each) do
      @stdout_io = StringIO.new
      Imdb::CLI.execute(@stdout_io, ["Star Trek"])
      @stdout_io.rewind
      @stdout = @stdout_io.read
    end
  
    it "report data" do
      @stdout.should =~ /0060028/
      @stdout.should =~ /Star Trek/
      @stdout.should =~ /1966/
    end
  end

  describe "yield one movie an ID" do
    before(:each) do
      @stdout_io = StringIO.new
      Imdb::CLI.execute(@stdout_io, ["0117731"])
      @stdout_io.rewind
      @stdout = @stdout_io.read
    end
  
    it "report data" do
      @stdout.should =~ /Star Trek\: First Contact \(1996\)/
      @stdout.should =~ /Jonathan Frakes/
    end
  end
  
  describe "yield one movie with an URL" do
    before(:each) do
      @stdout_io = StringIO.new
      Imdb::CLI.execute(@stdout_io, ["http://akas.imdb.com/title/tt0117731/"])
      @stdout_io.rewind
      @stdout = @stdout_io.read
    end
  
    it "report data" do
      @stdout.should =~ /Star Trek\: First Contact \(1996\)/
      @stdout.should =~ /Jonathan Frakes/
    end
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
imdb-0.6.8 spec/imdb/cli_spec.rb
imdb-0.6.7 spec/imdb/cli_spec.rb