Class: FixtureReducer::FixtureReducer
- Inherits:
-
Object
- Object
- FixtureReducer::FixtureReducer
- Defined in:
- lib/fixture_reducer.rb
Constant Summary collapse
- FIXTURE_REX =
also use multiline fixture declarations
/(^\s+)fixtures\s+([^,\s]+(,\s*[^,\s]+)*)/m
Instance Attribute Summary collapse
-
#test_file ⇒ Object
readonly
Returns the value of attribute test_file.
Instance Method Summary collapse
-
#initialize(test_file) ⇒ FixtureReducer
constructor
A new instance of FixtureReducer.
- #reduce_fixtures! ⇒ Object
Constructor Details
#initialize(test_file) ⇒ FixtureReducer
Returns a new instance of FixtureReducer.
10 11 12 13 14 |
# File 'lib/fixture_reducer.rb', line 10 def initialize(test_file) @test_file = test_file @test_folder = test_file.split("/").first @test_extension = "_#{@test_folder}.rb" end |
Instance Attribute Details
#test_file ⇒ Object (readonly)
Returns the value of attribute test_file.
8 9 10 |
# File 'lib/fixture_reducer.rb', line 8 def test_file @test_file end |
Instance Method Details
#reduce_fixtures! ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fixture_reducer.rb', line 16 def reduce_fixtures! if fixtures = fixture_params(test_file) puts "#{test_file} uses #{fixtures.join(", ")}" if run_with(fixtures) puts "initial run: SUCCESS" original_fixtures = fixtures.dup fixtures = reduced_via_common([99, 95, 90, 80, 50]) if fixtures == [":all"] fixtures = reduce_one_by_one(fixtures) report_and_keep_reduction(original_fixtures, fixtures) else puts "initial run: FAILED" end else puts "did not find fixtures in #{test_file}" end end |