require'spec_helper'describeGitlab::GithubImport::PageCounter,:clean_gitlab_redis_cachedolet(:project){double(:project,id: 1)}let(:counter){described_class.new(project,:issues)}describe'#initialize'doit'sets the initial page number to 1 when no value is cached'doexpect(counter.current).toeq(1)endit'sets the initial page number to the cached value when one is present'doGitlab::GithubImport::Caching.write(counter.cache_key,2)expect(described_class.new(project,:issues).current).toeq(2)endenddescribe'#set'doit'overwrites the page number when the given number is greater than the current number'docounter.set(4)expect(counter.current).toeq(4)endit'does not overwrite the page number when the given number is lower than the current number'docounter.set(2)counter.set(1)expect(counter.current).toeq(2)endendend