Sha256: 7b372cefc87932fb411a4c85661e6509d68797011fea5128c2330162622b2f26

Contents?: true

Size: 1.96 KB

Versions: 69

Compression:

Stored size: 1.96 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
    @context = Grntest::ExecutionContext.new
    @executor = Grntest::Executors::StandardIOExecutor.new(input, output,
                                                           @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

69 entries across 69 versions & 1 rubygems

Version Path
grntest-1.8.0 test/executors/test-standard-io-executor.rb
grntest-1.7.9 test/executors/test-standard-io-executor.rb
grntest-1.7.8 test/executors/test-standard-io-executor.rb
grntest-1.7.7 test/executors/test-standard-io-executor.rb
grntest-1.7.6 test/executors/test-standard-io-executor.rb
grntest-1.7.5 test/executors/test-standard-io-executor.rb
grntest-1.7.4 test/executors/test-standard-io-executor.rb
grntest-1.7.3 test/executors/test-standard-io-executor.rb
grntest-1.7.2 test/executors/test-standard-io-executor.rb
grntest-1.7.1 test/executors/test-standard-io-executor.rb
grntest-1.7.0 test/executors/test-standard-io-executor.rb
grntest-1.6.9 test/executors/test-standard-io-executor.rb
grntest-1.6.8 test/executors/test-standard-io-executor.rb
grntest-1.6.7 test/executors/test-standard-io-executor.rb
grntest-1.6.6 test/executors/test-standard-io-executor.rb
grntest-1.6.5 test/executors/test-standard-io-executor.rb
grntest-1.6.4 test/executors/test-standard-io-executor.rb
grntest-1.6.3 test/executors/test-standard-io-executor.rb
grntest-1.6.2 test/executors/test-standard-io-executor.rb
grntest-1.6.1 test/executors/test-standard-io-executor.rb