diff --git a/.travis.yml b/.travis.yml
index 2ab01b1..b7ed065 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,13 +3,9 @@ python:
     - 2.7
     - 3.4
     - pypy
-before_install:
-  - pip install codecov
 install:
     - pip install .
     - pip install behave dont-fudge-up
 script:
     - py.test -v tests
     - behave tests/features
-after_success:
-  - codecov
diff --git a/versionbump/filebump.py b/versionbump/filebump.py
index 65713cb..98d29f9 100644
--- a/versionbump/filebump.py
+++ b/versionbump/filebump.py
@@ -32,6 +32,7 @@ class FileBump(object):
     def write_cache_to_file(self):
         self.fo.seek(0)
         self.fo.write(self.file_cache)
+        self.fo.truncate()
 
     def replace_version_in_cache(self, old_version, new_version):
         self.file_cache = self.file_cache.replace(old_version, new_version)

FileBump does not correctly adjust the target file size
When adjusting the version in a file, the file size is not correctly adjusted.

For example:

File contents before bump:
```
0.1.22222
```

Command used:
```
versionbump -c 0.1.22222 minor version.txt
```

File contents after bump:
```
0.2.0
222
```

Ideally the file contents would be:
```
0.2.0
```
diff --git a/tests/unit/test_filebump.py b/tests/unit/test_filebump.py
index 7bddb5f..12bc26f 100644
--- a/tests/unit/test_filebump.py
+++ b/tests/unit/test_filebump.py
@@ -51,3 +51,12 @@ def test_it_doesnt_find_the_version():
     empty_fo = StringIO('')
     with pytest.raises(ValueError):
         FileBump(empty_fo, '1.2.3')
+
+
+def test_it_truncates_the_file():
+    version = '0.0.111'
+    fo = StringIO(version)
+    fb = FileBump(fo, version)
+    fb.bump('minor')
+    fo.seek(0)
+    assert fo.read() == '0.1.0'

pip install -e .
parse_log_pytest
pytest
behave pytest codecov
3.4
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
behave==1.2.6
certifi==2021.5.30
charset-normalizer==2.0.12
codecov==2.1.13
coverage==6.2
idna==3.10
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
parse==1.20.2
parse_type==0.6.4
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
requests==2.27.1
six==1.17.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
urllib3==1.26.20
-e git+https://github.com/vortec/versionbump.git@1b62d24471870d220f1f05ee1421a688f51d4923#egg=versionbump
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work

name: versionbump
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - attrs=21.4.0=pyhd3eb1b0_0
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - importlib-metadata=4.8.1=py36h06a4308_0
  - importlib_metadata=4.8.1=hd3eb1b0_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - more-itertools=8.12.0=pyhd3eb1b0_0
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - packaging=21.3=pyhd3eb1b0_0
  - pip=21.2.2=py36h06a4308_0
  - pluggy=0.13.1=py36h06a4308_0
  - py=1.11.0=pyhd3eb1b0_0
  - pyparsing=3.0.4=pyhd3eb1b0_0
  - pytest=6.2.4=py36h06a4308_2
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - toml=0.10.2=pyhd3eb1b0_0
  - typing_extensions=4.1.1=pyh06a4308_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zipp=3.6.0=pyhd3eb1b0_0
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - behave==1.2.6
      - charset-normalizer==2.0.12
      - codecov==2.1.13
      - coverage==6.2
      - idna==3.10
      - parse==1.20.2
      - parse-type==0.6.4
      - requests==2.27.1
      - six==1.17.0
      - urllib3==1.26.20
prefix: /opt/conda/envs/versionbump

tests/unit/test_filebump.py::test_it_truncates_the_file
tests/unit/test_filebump.py::test_file_gets_parsed_correctly tests/unit/test_filebump.py::test_file_cache tests/unit/test_filebump.py::test_bump tests/unit/test_filebump.py::test_cache_write_to_file tests/unit/test_filebump.py::test_print_output tests/unit/test_filebump.py::test_it_doesnt_find_the_version
.travis.yml versionbump/filebump.py
.travis.yml versionbump/filebump.py