annotate .svn/pristine/75/7537e9eba2daabb99d2e6fee47a3f35857d9e159.svn-base @ 1519:afce8026aaeb redmine-2.4-integration

Merge from branch "live"
author Chris Cannam
date Tue, 09 Sep 2014 09:34:53 +0100
parents cbb26bc654de
children
rev   line source
Chris@909 1 require File.dirname(__FILE__) + '/../test_helper'
Chris@909 2
Chris@909 3 class ArbitraryCodeMixingTest < Test::Unit::TestCase
Chris@909 4 def setup
Chris@909 5 Engines.code_mixing_file_types = %w(controller helper)
Chris@909 6 end
Chris@909 7
Chris@909 8 def test_should_allow_setting_of_different_code_mixing_file_types
Chris@909 9 assert_nothing_raised {
Chris@909 10 Engines.mix_code_from :things
Chris@909 11 }
Chris@909 12 end
Chris@909 13
Chris@909 14 def test_should_add_new_types_to_existing_code_mixing_file_types
Chris@909 15 Engines.mix_code_from :things
Chris@909 16 assert_equal ["controller", "helper", "thing"], Engines.code_mixing_file_types
Chris@909 17 Engines.mix_code_from :other
Chris@909 18 assert_equal ["controller", "helper", "thing", "other"], Engines.code_mixing_file_types
Chris@909 19 end
Chris@909 20
Chris@909 21 def test_should_allow_setting_of_multiple_types_at_once
Chris@909 22 Engines.mix_code_from :things, :other
Chris@909 23 assert_equal ["controller", "helper", "thing", "other"], Engines.code_mixing_file_types
Chris@909 24 end
Chris@909 25
Chris@909 26 def test_should_singularize_elements_to_be_mixed
Chris@909 27 # this is the only test using mocha, so let's try to work around it
Chris@909 28 # also, this seems to be already tested with the :things in the tests above
Chris@909 29 # arg = stub(:to_s => stub(:singularize => "element"))
Chris@909 30 Engines.mix_code_from :elements
Chris@909 31 assert Engines.code_mixing_file_types.include?("element")
Chris@909 32 end
Chris@909 33
Chris@909 34 # TODO doesn't seem to work as expected?
Chris@909 35
Chris@909 36 # def test_should_successfully_mix_custom_types
Chris@909 37 # Engines.mix_code_from :things
Chris@909 38 # assert_equal 'Thing (from app)', Thing.from_app
Chris@909 39 # assert_equal 'Thing (from test_code_mixing)', Thing.from_plugin
Chris@909 40 # end
Chris@909 41 end