Class: ArbitraryCodeMixingTest

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
vendor/plugins/engines/test/unit/arbitrary_code_mixing_test.rb

Instance Method Summary

Instance Method Details

- (Object) setup



4
5
6
# File 'vendor/plugins/engines/test/unit/arbitrary_code_mixing_test.rb', line 4

def setup
  Engines.code_mixing_file_types = %w(controller helper)
end

- (Object) test_should_add_new_types_to_existing_code_mixing_file_types



14
15
16
17
18
19
# File 'vendor/plugins/engines/test/unit/arbitrary_code_mixing_test.rb', line 14

def test_should_add_new_types_to_existing_code_mixing_file_types
  Engines.mix_code_from :things
  assert_equal ["controller", "helper", "thing"], Engines.code_mixing_file_types
  Engines.mix_code_from :other
  assert_equal ["controller", "helper", "thing", "other"], Engines.code_mixing_file_types
end

- (Object) test_should_allow_setting_of_different_code_mixing_file_types



8
9
10
11
12
# File 'vendor/plugins/engines/test/unit/arbitrary_code_mixing_test.rb', line 8

def test_should_allow_setting_of_different_code_mixing_file_types
  assert_nothing_raised {
    Engines.mix_code_from :things
  }
end

- (Object) test_should_allow_setting_of_multiple_types_at_once



21
22
23
24
# File 'vendor/plugins/engines/test/unit/arbitrary_code_mixing_test.rb', line 21

def test_should_allow_setting_of_multiple_types_at_once
  Engines.mix_code_from :things, :other
  assert_equal ["controller", "helper", "thing", "other"], Engines.code_mixing_file_types
end

- (Object) test_should_singularize_elements_to_be_mixed



26
27
28
29
30
31
32
# File 'vendor/plugins/engines/test/unit/arbitrary_code_mixing_test.rb', line 26

def test_should_singularize_elements_to_be_mixed
  # this is the only test using mocha, so let's try to work around it
  # also, this seems to be already tested with the :things in the tests above
  # arg = stub(:to_s => stub(:singularize => "element")) 
  Engines.mix_code_from :elements
  assert Engines.code_mixing_file_types.include?("element")
end