Sha256: 7d22e5f4379d7919f03248b0cd0c71719d2b37e30b87eddf6abb7444cddb5464

Contents?: true

Size: 976 Bytes

Versions: 8

Compression:

Stored size: 976 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').convert("-resize 5x5 ; touch tmp/stuff").apply
      rescue Dragonfly::Shell::CommandFailed
      end
      File.exist?('tmp/stuff').should be_false
    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

8 entries across 8 versions & 1 rubygems

Version Path
dragonfly-1.0.7 spec/functional/shell_commands_spec.rb
dragonfly-1.0.6 spec/functional/shell_commands_spec.rb
dragonfly-1.0.5 spec/functional/shell_commands_spec.rb
dragonfly-1.0.4 spec/functional/shell_commands_spec.rb
dragonfly-1.0.3 spec/functional/shell_commands_spec.rb
dragonfly-1.0.2 spec/functional/shell_commands_spec.rb
dragonfly-1.0.1 spec/functional/shell_commands_spec.rb
dragonfly-1.0 spec/functional/shell_commands_spec.rb