tracks/ruby/test/generator/implementation_test.rb in trackler-2.1.0.48 vs tracks/ruby/test/generator/implementation_test.rb in trackler-2.1.0.49

- old
+ new

@@ -7,17 +7,20 @@ track: 'test/fixtures/xruby' ) def test_version exercise = Minitest::Mock.new.expect :slug, 'alpha' - subject = Implementation.new(paths: FixturePaths, exercise: exercise) + repository = Repository.new(paths: FixturePaths, slug: 'alpha') + subject = Implementation.new(repository: repository, exercise: exercise) assert_equal 1, subject.version end def test_update_tests_version mock_file = Minitest::Mock.new.expect :write, '2'.length, [2] - subject = Implementation.new(paths: FixturePaths, exercise: Exercise.new(slug: 'alpha')) + exercise = Exercise.new(slug: 'alpha') + repository = Repository.new(paths: FixturePaths, slug: 'alpha') + subject = Implementation.new(repository: repository, exercise: exercise) # Verify iniital condition from fixture file assert_equal 1, subject.tests_version.to_i File.stub(:open, true, mock_file) do assert_equal 2, subject.update_tests_version end @@ -25,11 +28,13 @@ end def test_update_example_solution expected_content = "# This is the example\n\nclass BookKeeping\n VERSION = 1\nend\n" mock_file = Minitest::Mock.new.expect :write, expected_content.length, [expected_content] - subject = Implementation.new(paths: FixturePaths, exercise: Exercise.new(slug: 'alpha')) + exercise = Exercise.new(slug: 'alpha') + repository = Repository.new(paths: FixturePaths, slug: 'alpha') + subject = Implementation.new(repository: repository, exercise: exercise) File.stub(:open, true, mock_file) do assert_equal expected_content, subject.update_example_solution end mock_file.verify end @@ -78,10 +83,12 @@ assert_equal 1, BookKeeping::VERSION end end TESTS_FILE mock_file = Minitest::Mock.new.expect :write, expected_content.length, [expected_content] - subject = Implementation.new(paths: FixturePaths, exercise: Exercise.new(slug: 'alpha')) + exercise = Exercise.new(slug: 'alpha') + repository = Repository.new(paths: FixturePaths, slug: 'alpha') + subject = Implementation.new(repository: repository, exercise: exercise) GitCommand.stub(:abbreviated_commit_hash, '123456789') do File.stub(:open, true, mock_file) do assert_equal expected_content, subject.build_tests end end