Commit 5d63d531c272c1a123179874e75b2786b022cc42
1 parent
e0e6ee0c
Exists in
master
and in
1 other branch
Feeds specs.
Showing
2 changed files
with
20 additions
and
7 deletions
Show diff stats
spec/controllers/apps_controller_spec.rb
| ... | ... | @@ -37,6 +37,8 @@ describe AppsController do |
| 37 | 37 | before(:each) do |
| 38 | 38 | sign_in Factory(:admin) |
| 39 | 39 | @app = Factory(:app) |
| 40 | + @err = Factory :err, :app => @app | |
| 41 | + @notice = Factory :notice, :err => @err | |
| 40 | 42 | end |
| 41 | 43 | |
| 42 | 44 | it 'finds the app' do |
| ... | ... | @@ -48,6 +50,12 @@ describe AppsController do |
| 48 | 50 | Factory :err, :app => @app |
| 49 | 51 | lambda { get :show, :id => @app.id }.should_not raise_error |
| 50 | 52 | end |
| 53 | + | |
| 54 | + it "should list atom feed successfully" do | |
| 55 | + get :show, :id => @app.id, :format => "atom" | |
| 56 | + response.should be_success | |
| 57 | + response.body.should match(@err.message) | |
| 58 | + end | |
| 51 | 59 | end |
| 52 | 60 | |
| 53 | 61 | context 'logged in as a user' do | ... | ... |
spec/controllers/errs_controller_spec.rb
| ... | ... | @@ -11,19 +11,24 @@ describe ErrsController do |
| 11 | 11 | let(:err) { Factory(:err, :app => app) } |
| 12 | 12 | |
| 13 | 13 | describe "GET /errs" do |
| 14 | + render_views | |
| 14 | 15 | context 'when logged in as an admin' do |
| 15 | 16 | before(:each) do |
| 16 | 17 | sign_in Factory(:admin) |
| 18 | + @notice = Factory :notice | |
| 19 | + @err = @notice.err | |
| 17 | 20 | end |
| 18 | 21 | |
| 19 | - it "gets a paginated list of unresolved errs" do | |
| 20 | - errs = WillPaginate::Collection.new(1,30) | |
| 21 | - 3.times { errs << Factory(:err) } | |
| 22 | - Err.should_receive(:unresolved).and_return( | |
| 23 | - mock('proxy', :ordered => mock('proxy', :paginate => errs)) | |
| 24 | - ) | |
| 22 | + it "should successfully list errs" do | |
| 25 | 23 | get :index |
| 26 | - assigns(:errs).should == errs | |
| 24 | + response.should be_success | |
| 25 | + response.body.should match(@err.message) | |
| 26 | + end | |
| 27 | + | |
| 28 | + it "should list atom feed successfully" do | |
| 29 | + get :index, :format => "atom" | |
| 30 | + response.should be_success | |
| 31 | + response.body.should match(@err.message) | |
| 27 | 32 | end |
| 28 | 33 | |
| 29 | 34 | it "should handle lots of errors" do | ... | ... |