Sha256: 9941364acd524fec59a567a394a4538737194e200202bf9bec8327e5eda19d1d

Contents?: true

Size: 977 Bytes

Versions: 14

Compression:

Stored size: 977 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_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

14 entries across 14 versions & 1 rubygems

Version Path
dragonfly-1.3.0 spec/functional/shell_commands_spec.rb
dragonfly-1.2.1 spec/functional/shell_commands_spec.rb
dragonfly-1.2.0 spec/functional/shell_commands_spec.rb
dragonfly-1.1.5 spec/functional/shell_commands_spec.rb
dragonfly-1.1.4 spec/functional/shell_commands_spec.rb
dragonfly-1.1.3 spec/functional/shell_commands_spec.rb
dragonfly-1.1.2 spec/functional/shell_commands_spec.rb
dragonfly-1.1.1 spec/functional/shell_commands_spec.rb
dragonfly-1.1.0 spec/functional/shell_commands_spec.rb
dragonfly-1.0.12 spec/functional/shell_commands_spec.rb
dragonfly-1.0.11 spec/functional/shell_commands_spec.rb
dragonfly-1.0.10 spec/functional/shell_commands_spec.rb
dragonfly-1.0.9 spec/functional/shell_commands_spec.rb
dragonfly-1.0.8 spec/functional/shell_commands_spec.rb