Sha256: 8a79efe4dd36569b91bbc89f7b5e98df36a7ea596275e24513df3e5a37e1e4c0

Contents?: true

Size: 1.88 KB

Versions: 9

Compression:

Stored size: 1.88 KB

Contents

# Copyright (C) 2012-2013  Kouhei Sutou <kou@clear-code.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

require "stringio"
require "tempfile"
require "grntest/executors/standard-io-executor"

class TestStandardIOExecutor < Test::Unit::TestCase
  def setup
    input = StringIO.new
    output = StringIO.new
    @executor = Grntest::Executors::StandardIOExecutor.new(input, output)
    @context = @executor.context
    @script = Tempfile.new("test-executor")
  end

  private
  def execute(command)
    @script.puts(command)
    @script.close
    @executor.execute(Pathname(@script.path))
  end

  class TestComment < self
    def test_disable_logging
      assert_predicate(@context, :logging?)
      execute("\#@disable-logging")
      assert_not_predicate(@context, :logging?)
    end

    def test_enable_logging
      @context.logging = false
      assert_not_predicate(@context, :logging?)
      execute("\#@enable-logging")
      assert_predicate(@context, :logging?)
    end

    def test_suggest_create_dataset
      mock(@executor).execute_suggest_create_dataset("shop")
      execute("\#@suggest-create-dataset shop")
    end

    def test_enable_ignore_feature_on_error
      assert_not_equal(:omit, @context.on_error)
      execute("\#@on-error omit")
      assert_equal(:omit, @context.on_error)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
grntest-1.1.1 test/executors/test-standard-io-executor.rb
grntest-1.1.0 test/executors/test-standard-io-executor.rb
grntest-1.0.9 test/executors/test-standard-io-executor.rb
grntest-1.0.8 test/executors/test-standard-io-executor.rb
grntest-1.0.7 test/executors/test-standard-io-executor.rb
grntest-1.0.6 test/executors/test-standard-io-executor.rb
grntest-1.0.5 test/executors/test-standard-io-executor.rb
grntest-1.0.4 test/executors/test-standard-io-executor.rb
grntest-1.0.3 test/executors/test-standard-io-executor.rb