           promise.then ->
             $modal = $('.up-modal')
             $viewport = $modal.find('.up-modal-viewport')
+            scrollbarWidth = up.viewport.scrollbarWidth()
 
             expect($modal).toBeAttached()
             expect($viewport.css('overflow-y')).toEqual('scroll')
             expect($rootOverflowElement.css('overflow-y')).toEqual('hidden')
-            expect(parseInt($body.css('padding-right'))).toBeAround(assumedScrollbarWidth, 5)
+            expect(parseInt($body.css('padding-right'))).toBeAround(scrollbarWidth, 5)
 
             up.modal.close().then ->
               expect($rootOverflowElement.css('overflow-y')).toEqual('scroll')


        it 'does not open multiple modals or pad the body twice if the user starts loading a second modal before the first was done loading', (done) ->
          up.modal.config.closeDuration = 10

          # Load a first modal
          up.modal.visit('/path1', target: '.container', animation: 'fade-in', duration: 50)


            @respondWith('<div class="container">text</div>')

          promise.then ->
            expect(parseInt($anchoredElement.css('right'))).toBeAround(30 + scrollbarWidth, 10)

            up.modal.close().then ->
              expect(parseInt($anchoredElement.css('right'))).toBeAround(30 , 10)
