Commit 1c268e703a03d7180e74bccca7e0a796a1d11b10

Authored by Cyril Mougel
1 parent 04290491
Exists in master and in 1 other branch production

Move some test view in spec/views instead of render_views in

spec/controllers
spec/controllers/apps_controller_spec.rb
1 require 'spec_helper' 1 require 'spec_helper'
2 2
3 describe AppsController do 3 describe AppsController do
4 - render_views  
5 4
6 it_requires_authentication 5 it_requires_authentication
7 it_requires_admin_privileges :for => {:new => :get, :edit => :get, :create => :post, :update => :put, :destroy => :delete} 6 it_requires_admin_privileges :for => {:new => :get, :edit => :get, :create => :post, :update => :put, :destroy => :delete}
@@ -314,7 +313,6 @@ describe AppsController do @@ -314,7 +313,6 @@ describe AppsController do
314 313
315 @app.reload 314 @app.reload
316 @app.issue_tracker_configured?.should == false 315 @app.issue_tracker_configured?.should == false
317 - response.body.should match(/You must specify your/)  
318 end 316 end
319 end 317 end
320 end 318 end
spec/views/apps/edit.html.haml_spec.rb
1 require 'spec_helper' 1 require 'spec_helper'
2 2
3 describe "apps/edit.html.haml" do 3 describe "apps/edit.html.haml" do
  4 + let(:app) { stub_model(App) }
4 before do 5 before do
5 - app = stub_model(App)  
6 view.stub(:app).and_return(app) 6 view.stub(:app).and_return(app)
7 controller.stub(:current_user) { stub_model(User) } 7 controller.stub(:current_user) { stub_model(User) }
8 end 8 end
@@ -19,5 +19,19 @@ describe "apps/edit.html.haml" do @@ -19,5 +19,19 @@ describe "apps/edit.html.haml" do
19 end 19 end
20 20
21 end 21 end
  22 +
  23 + context "with unvalid app" do
  24 + let(:app) {
  25 + app = stub_model(App)
  26 + app.errors.add(:base,'You must specify your')
  27 + app
  28 + }
  29 +
  30 + it 'see the error' do
  31 + render
  32 + rendered.should match(/You must specify your/)
  33 + end
  34 + end
  35 +
22 end 36 end
23 37
spec/views/apps/new.html.haml_spec.rb 0 → 100644
@@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
  1 +require 'spec_helper'
  2 +
  3 +describe "apps/new.html.haml" do
  4 + let(:app) { stub_model(App) }
  5 + before do
  6 + view.stub(:app).and_return(app)
  7 + controller.stub(:current_user) { stub_model(User) }
  8 + end
  9 +
  10 + describe "content_for :action_bar" do
  11 + def action_bar
  12 + view.content_for(:action_bar)
  13 + end
  14 +
  15 + it "should confirm the 'cancel' link" do
  16 + render
  17 +
  18 + action_bar.should have_selector('a.button', :text => 'cancel')
  19 + end
  20 +
  21 + end
  22 +
  23 + context "with unvalid app" do
  24 + let(:app) {
  25 + app = stub_model(App)
  26 + app.errors.add(:base,'You must specify your')
  27 + app
  28 + }
  29 +
  30 + it 'see the error' do
  31 + render
  32 + rendered.should match(/You must specify your/)
  33 + end
  34 + end
  35 +
  36 +end
  37 +
spec/views/apps/show.html.haml_spec.rb 0 → 100644
@@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
  1 +require 'spec_helper'
  2 +
  3 +describe "apps/show.html.haml" do
  4 + let(:app) { stub_model(App) }
  5 + before do
  6 + view.stub(:app).and_return(app)
  7 + view.stub(:all_errs).and_return(false)
  8 + view.stub(:deploys).and_return([])
  9 + controller.stub(:current_user) { stub_model(User) }
  10 + end
  11 +
  12 + describe "content_for :action_bar" do
  13 + def action_bar
  14 + view.content_for(:action_bar)
  15 + end
  16 +
  17 + it "should confirm the 'cancel' link" do
  18 + render
  19 +
  20 + action_bar.should have_selector('a.button', :text => 'all errs')
  21 + end
  22 +
  23 + end
  24 +
  25 + context "without errs" do
  26 + it 'see no errs' do
  27 + render
  28 + rendered.should match(/No errs have been/)
  29 + end
  30 + end
  31 +end
  32 +
spec/views/problems/show.ics.haml_spec.rb
@@ -7,7 +7,7 @@ describe "problems/show.html.ics" do @@ -7,7 +7,7 @@ describe "problems/show.html.ics" do
7 end 7 end
8 8
9 it 'should work' do 9 it 'should work' do
10 - render :template => 'problems/show.ics.haml' 10 + render :template => 'problems/show', :formats => [:ics], :handlers => [:haml]
11 end 11 end
12 12
13 13