diff --git a/spec/controllers/apps_controller_spec.rb b/spec/controllers/apps_controller_spec.rb index 8d50ae8..91ddc4e 100644 --- a/spec/controllers/apps_controller_spec.rb +++ b/spec/controllers/apps_controller_spec.rb @@ -1,7 +1,6 @@ require 'spec_helper' describe AppsController do - render_views it_requires_authentication it_requires_admin_privileges :for => {:new => :get, :edit => :get, :create => :post, :update => :put, :destroy => :delete} @@ -314,7 +313,6 @@ describe AppsController do @app.reload @app.issue_tracker_configured?.should == false - response.body.should match(/You must specify your/) end end end diff --git a/spec/views/apps/edit.html.haml_spec.rb b/spec/views/apps/edit.html.haml_spec.rb index f0ad618..22ef758 100644 --- a/spec/views/apps/edit.html.haml_spec.rb +++ b/spec/views/apps/edit.html.haml_spec.rb @@ -1,8 +1,8 @@ require 'spec_helper' describe "apps/edit.html.haml" do + let(:app) { stub_model(App) } before do - app = stub_model(App) view.stub(:app).and_return(app) controller.stub(:current_user) { stub_model(User) } end @@ -19,5 +19,19 @@ describe "apps/edit.html.haml" do end end + + context "with unvalid app" do + let(:app) { + app = stub_model(App) + app.errors.add(:base,'You must specify your') + app + } + + it 'see the error' do + render + rendered.should match(/You must specify your/) + end + end + end diff --git a/spec/views/apps/new.html.haml_spec.rb b/spec/views/apps/new.html.haml_spec.rb new file mode 100644 index 0000000..96ec9ee --- /dev/null +++ b/spec/views/apps/new.html.haml_spec.rb @@ -0,0 +1,37 @@ +require 'spec_helper' + +describe "apps/new.html.haml" do + let(:app) { stub_model(App) } + before do + view.stub(:app).and_return(app) + controller.stub(:current_user) { stub_model(User) } + end + + describe "content_for :action_bar" do + def action_bar + view.content_for(:action_bar) + end + + it "should confirm the 'cancel' link" do + render + + action_bar.should have_selector('a.button', :text => 'cancel') + end + + end + + context "with unvalid app" do + let(:app) { + app = stub_model(App) + app.errors.add(:base,'You must specify your') + app + } + + it 'see the error' do + render + rendered.should match(/You must specify your/) + end + end + +end + diff --git a/spec/views/apps/show.html.haml_spec.rb b/spec/views/apps/show.html.haml_spec.rb new file mode 100644 index 0000000..2904193 --- /dev/null +++ b/spec/views/apps/show.html.haml_spec.rb @@ -0,0 +1,32 @@ +require 'spec_helper' + +describe "apps/show.html.haml" do + let(:app) { stub_model(App) } + before do + view.stub(:app).and_return(app) + view.stub(:all_errs).and_return(false) + view.stub(:deploys).and_return([]) + controller.stub(:current_user) { stub_model(User) } + end + + describe "content_for :action_bar" do + def action_bar + view.content_for(:action_bar) + end + + it "should confirm the 'cancel' link" do + render + + action_bar.should have_selector('a.button', :text => 'all errs') + end + + end + + context "without errs" do + it 'see no errs' do + render + rendered.should match(/No errs have been/) + end + end +end + diff --git a/spec/views/problems/show.ics.haml_spec.rb b/spec/views/problems/show.ics.haml_spec.rb index f446181..81d61fe 100644 --- a/spec/views/problems/show.ics.haml_spec.rb +++ b/spec/views/problems/show.ics.haml_spec.rb @@ -7,7 +7,7 @@ describe "problems/show.html.ics" do end it 'should work' do - render :template => 'problems/show.ics.haml' + render :template => 'problems/show', :formats => [:ics], :handlers => [:haml] end -- libgit2 0.21.2