From 30ea6ef72fb4ab48d7e0bd3b4d1e9f3fb738f372 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sat, 18 Jun 2016 23:08:38 +0200 Subject: [PATCH] fix spec for ApplicationHelper#changelog_url --- lib/configuration_methods.rb | 2 -- spec/helpers/application_helper_spec.rb | 16 +++++++--------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/configuration_methods.rb b/lib/configuration_methods.rb index 6d5c1f503..fc085afdd 100644 --- a/lib/configuration_methods.rb +++ b/lib/configuration_methods.rb @@ -89,13 +89,11 @@ module Configuration get_git_info if git_available? @git_revision end - attr_writer :git_revision def git_update get_git_info if git_available? @git_update end - attr_writer :git_update def rails_asset_id (git_revision || version)[0..8] diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 8ce0ea39c..dae93ace1 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -88,17 +88,16 @@ describe ApplicationHelper, :type => :helper do end end - describe '#changelog_url' do - it 'defaults to master branch changleog' do - AppConfig.git_revision = nil - expect(changelog_url).to eq('https://github.com/diaspora/diaspora/blob/master/Changelog.md') + describe "#changelog_url" do + it "defaults to master branch changleog" do + expect(AppConfig).to receive(:git_revision).and_return(nil) + expect(changelog_url).to eq("https://github.com/diaspora/diaspora/blob/master/Changelog.md") end - it 'displays the changelog for the current git revision if set' do - AppConfig.git_revision = '123' - expect(changelog_url).to eq('https://github.com/diaspora/diaspora/blob/123/Changelog.md') + it "displays the changelog for the current git revision if set" do + expect(AppConfig).to receive(:git_revision).twice.and_return("123") + expect(changelog_url).to eq("https://github.com/diaspora/diaspora/blob/123/Changelog.md") end - end describe '#pod_name' do @@ -108,7 +107,6 @@ describe ApplicationHelper, :type => :helper do it 'displays the supplied pod_name if it is set' do AppConfig.settings.pod_name = "Catspora" - # require 'pry'; binding.pry expect(pod_name).to match "Catspora" end end