Commit 1c268e703a03d7180e74bccca7e0a796a1d11b10
1 parent
04290491
Exists in
master
and in
1 other branch
Move some test view in spec/views instead of render_views in
spec/controllers
Showing
5 changed files
with
85 additions
and
4 deletions
Show diff stats
spec/controllers/apps_controller_spec.rb
| 1 | 1 | require 'spec_helper' |
| 2 | 2 | |
| 3 | 3 | describe AppsController do |
| 4 | - render_views | |
| 5 | 4 | |
| 6 | 5 | it_requires_authentication |
| 7 | 6 | it_requires_admin_privileges :for => {:new => :get, :edit => :get, :create => :post, :update => :put, :destroy => :delete} |
| ... | ... | @@ -314,7 +313,6 @@ describe AppsController do |
| 314 | 313 | |
| 315 | 314 | @app.reload |
| 316 | 315 | @app.issue_tracker_configured?.should == false |
| 317 | - response.body.should match(/You must specify your/) | |
| 318 | 316 | end |
| 319 | 317 | end |
| 320 | 318 | end | ... | ... |
spec/views/apps/edit.html.haml_spec.rb
| 1 | 1 | require 'spec_helper' |
| 2 | 2 | |
| 3 | 3 | describe "apps/edit.html.haml" do |
| 4 | + let(:app) { stub_model(App) } | |
| 4 | 5 | before do |
| 5 | - app = stub_model(App) | |
| 6 | 6 | view.stub(:app).and_return(app) |
| 7 | 7 | controller.stub(:current_user) { stub_model(User) } |
| 8 | 8 | end |
| ... | ... | @@ -19,5 +19,19 @@ describe "apps/edit.html.haml" do |
| 19 | 19 | end |
| 20 | 20 | |
| 21 | 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 | 36 | end |
| 23 | 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 | + | ... | ... |
| ... | ... | @@ -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