Commit 5d63d531c272c1a123179874e75b2786b022cc42

Authored by Nick Recobra
1 parent e0e6ee0c
Exists in master and in 1 other branch production

Feeds specs.

spec/controllers/apps_controller_spec.rb
@@ -37,6 +37,8 @@ describe AppsController do @@ -37,6 +37,8 @@ describe AppsController do
37 before(:each) do 37 before(:each) do
38 sign_in Factory(:admin) 38 sign_in Factory(:admin)
39 @app = Factory(:app) 39 @app = Factory(:app)
  40 + @err = Factory :err, :app => @app
  41 + @notice = Factory :notice, :err => @err
40 end 42 end
41 43
42 it 'finds the app' do 44 it 'finds the app' do
@@ -48,6 +50,12 @@ describe AppsController do @@ -48,6 +50,12 @@ describe AppsController do
48 Factory :err, :app => @app 50 Factory :err, :app => @app
49 lambda { get :show, :id => @app.id }.should_not raise_error 51 lambda { get :show, :id => @app.id }.should_not raise_error
50 end 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 end 59 end
52 60
53 context 'logged in as a user' do 61 context 'logged in as a user' do
spec/controllers/errs_controller_spec.rb
@@ -11,19 +11,24 @@ describe ErrsController do @@ -11,19 +11,24 @@ describe ErrsController do
11 let(:err) { Factory(:err, :app => app) } 11 let(:err) { Factory(:err, :app => app) }
12 12
13 describe "GET /errs" do 13 describe "GET /errs" do
  14 + render_views
14 context 'when logged in as an admin' do 15 context 'when logged in as an admin' do
15 before(:each) do 16 before(:each) do
16 sign_in Factory(:admin) 17 sign_in Factory(:admin)
  18 + @notice = Factory :notice
  19 + @err = @notice.err
17 end 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 get :index 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 end 32 end
28 33
29 it "should handle lots of errors" do 34 it "should handle lots of errors" do