Sha256: 65443a7649a17d6b82a91519a8ccf095e35cb8005ecc3fa301a58a7bd073ed8a

Contents?: true

Size: 1.07 KB

Versions: 3

Compression:

Stored size: 1.07 KB

Contents

require 'stj/meme'

describe STJ::Meme do

  let(:temp_dir) { File.join(SPEC_PATH, "temp") }

  before do
    FileUtils.mkdir(temp_dir) unless File.exists?(temp_dir)
  end

  after do
    FileUtils.rm_rf(temp_dir) if File.exists?(temp_dir)
  end

  it "has a default bottom phrase" do
    expect(STJ::Meme.new("").default_phrase).to eq("THEN I SPOKE TO JOE")
  end

  it "have a first_phrase" do
    expect(STJ::Meme.new("this is a test").first_phrase).to eq("this is a test")
  end

  it "has an image" do
    expect(STJ::Meme.new("").image).to eq(File.join(LIB_PATH, 'images', 'crying-girl-joe.jpg'))
  end

  it "has an output file name" do
    expect(STJ::Meme.new("I didn't know    how to make gems").output_file_name).to eq("tistj_i_didnt_know_how_to_make_gems.jpg")
  end

  it "generates a meme image" do
    meme = STJ::Meme.new("I thought I knew Clojure")
    meme.create(temp_dir)
    expect(File.exists?(File.join(temp_dir, "tistj_i_thought_i_knew_clojure.jpg"))).to be_true
    expect(FileUtils.cmp(meme.image, File.join(temp_dir, meme.output_file_name))).to be_false
  end


end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
stj-1.0.2 spec/meme_spec.rb
stj-1.0.1 spec/meme_spec.rb
stj-1.0.0 spec/meme_spec.rb