Commit f8bfb12483c97f9f74381d45cb71df9f77484d7a

Authored by Stephen Crosby
1 parent 3d01285d
Exists in master and in 1 other branch production

Add spec for #655

Hint: This diff is much easier to read if you ignore whitespace
Showing 1 changed file with 33 additions and 9 deletions   Show diff stats
spec/views/problems/show.html.haml_spec.rb
@@ -115,25 +115,49 @@ describe "problems/show.html.haml" do @@ -115,25 +115,49 @@ describe "problems/show.html.haml" do
115 before do 115 before do
116 with_issue_tracker("PivotalLabsTracker", problem) 116 with_issue_tracker("PivotalLabsTracker", problem)
117 end 117 end
118 - context "with problem without issue link" do 118 +
  119 + context "with app having github_repo" do
  120 + let(:app) { App.new(:new_record => false, :github_repo => 'foo/bar') }
  121 + let(:problem){ Problem.new(:new_record => false, :app => app) }
  122 +
119 before do 123 before do
120 problem.issue_link = nil 124 problem.issue_link = nil
  125 + user = Fabricate(:user, :github_login => 'test_user', :github_oauth_token => 'abcdef')
  126 + controller.stub(:current_user) { user }
121 end 127 end
122 - it 'not see link if no issue tracker' do 128 +
  129 + it 'links to the associated tracker' do
123 render 130 render
124 - expect(view.content_for(:action_bar)).to match(/create issue/) 131 + expect(view.content_for(:action_bar)).to match(".pivotal_create.create-issue")
125 end 132 end
126 133
  134 + it 'does not link to github' do
  135 + render
  136 + expect(view.content_for(:action_bar)).to_not match(".github_create.create-issue")
  137 + end
127 end 138 end
128 139
129 - context "with problem with issue link" do  
130 - before do  
131 - problem.issue_link = 'http://foo' 140 + context "without app having github_repo" do
  141 + context "with problem without issue link" do
  142 + before do
  143 + problem.issue_link = nil
  144 + end
  145 + it 'not see link if no issue tracker' do
  146 + render
  147 + expect(view.content_for(:action_bar)).to match(/create issue/)
  148 + end
  149 +
132 end 150 end
133 151
134 - it 'not see link if no issue tracker' do  
135 - render  
136 - expect(view.content_for(:action_bar)).to_not match(/create issue/) 152 + context "with problem with issue link" do
  153 + before do
  154 + problem.issue_link = 'http://foo'
  155 + end
  156 +
  157 + it 'not see link if no issue tracker' do
  158 + render
  159 + expect(view.content_for(:action_bar)).to_not match(/create issue/)
  160 + end
137 end 161 end
138 end 162 end
139 163