spec/controllers/rinfo_controller_spec.rb in rinfo-0.1.2 vs spec/controllers/rinfo_controller_spec.rb in rinfo-0.1.3

- old
+ new

@@ -9,25 +9,25 @@ # create temporary directory @tmpdir = Dir.mktmpdir Dir.chdir(@tmpdir) # initialize a git repository - git = Git.init(Dir.pwd) + @git = Git.init(Dir.pwd) FileUtils.touch("#{Dir.pwd}/initial-file.txt") @name = 'Spec Ninja' - git.config('user.name', @name) - git.config('user.email', 'spec_ninja@example.com') - git.add - git.commit('initial commit') + @git.config('user.name', @name) + @git.config('user.email', 'spec_ninja@example.com') + @git.add + @git.commit('initial commit') # checkout our desired branch @branch_name = 'foo-bar-branch' - git.branch(@branch_name).checkout + @git.branch(@branch_name).checkout # set the other things we're checking for - @rev = git.revparse('HEAD') - @date = git.log.first.date + @rev = @git.revparse('HEAD') + @date = @git.log.first.date end before(:each) do Rinfo.stub(:root).and_return(@tmpdir) end @@ -131,9 +131,19 @@ (rails_envs - custom_blacklist).each do |env| Rinfo.stub(:env).and_return(env.to_s) get 'info', format: :json response.body.should == rinfo end + end + end + + context 'git config user.name is blank' do + before(:each) { @git.config('user.name', '') } + after(:each) { @git.config('user.name', @name) } + + it 'displays the author name on the last commit' do + get 'info', format: :json + response.body.should == rinfo end end end end