Sha256: b3e9e5178faf55f46cfaf81b3b15d2fa282f1c540a3c9fa7a2e8f45e0916fb3c

Contents?: true

Size: 1.29 KB

Versions: 6

Compression:

Stored size: 1.29 KB

Contents

require "spec_helper"

describe ORS::Commands::Runner do

  context "#run" do
    before do
      stub(subject).name {'abc/growhealthy'}
      stub(subject).environment {'production'}
    end

    it "should require --code 'ruby code'" do
      lambda {subject.execute}.should raise_error
    end

    it "should require an argument to --code" do
      ORS::Config.parse_options %w(--code)
      lambda {subject.execute}.should raise_error
    end

    it "should require an argument to -c" do
      ORS::Config.parse_options %w(--c)
      lambda {subject.execute}.should raise_error
    end

    it "should require a non-empty argument to --code" do
      ORS::Config.parse_options ['--code', ' ']
      lambda {subject.execute}.should raise_error
    end

    it "should be successful with an argument to --code" do
      ORS::Config.parse_options %w(--code true)
      mock(subject).execute_command(is_a(String), is_a(Array), is_a(String), is_a(Hash)).returns("results")
      lambda {subject.execute}.should_not raise_error
    end

    it "should be successful with an argument to -c" do
      ORS::Config.parse_options %w(-c true)
      mock(subject).execute_command(is_a(String), is_a(Array), is_a(String), is_a(Hash)).returns("results")
      lambda {subject.execute}.should_not raise_error
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ors-0.2.10 spec/ors/commands/runner_spec.rb
ors-0.2.9 spec/ors/commands/runner_spec.rb
ors-0.2.8 spec/ors/commands/runner_spec.rb
ors-0.2.7 spec/ors/commands/runner_spec.rb
ors-0.2.6 spec/ors/commands/runner_spec.rb
ors-0.2.5 spec/ors/commands/runner_spec.rb