Sha256: 004864abf5f5dda37c40580635d0c57204a75dc00941465f97de96893aaffdf2

Contents?: true

Size: 950 Bytes

Versions: 2

Compression:

Stored size: 950 Bytes

Contents

require "spec_helper"

describe "using the shell" do
  let (:app) { test_app }

  describe "shell injection" do
    it "should not allow it!" do
      app.configure_with(:imagemagick)
      begin
        app.generate(:plain, 10, 10, "white; touch tmp/stuff").apply
      rescue Dragonfly::Shell::CommandFailed
      end
      File.exist?("tmp/stuff").should be_falsey
    end
  end

  describe "env variables with imagemagick" do
    it "allows configuring the convert path" do
      app.configure_with(:imagemagick, :convert_command => "/bin/convert")
      app.shell.should_receive(:run).with(%r[/bin/convert], hash_including)
      app.create("").thumb("30x30").apply
    end

    it "allows configuring the identify path" do
      app.configure_with(:imagemagick, :identify_command => "/bin/identify")
      app.shell.should_receive(:run).with(%r[/bin/identify], hash_including).and_return("JPG 1 1")
      app.create("").width
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dragonfly-1.4.1 spec/functional/shell_commands_spec.rb
dragonfly-1.4.0 spec/functional/shell_commands_spec.rb