Commit 3a50537280ee143b13ae724f95958222a7f25b37
1 parent
f7792c26
Exists in
master
and in
1 other branch
Adds rudimentary specs for problems/search
Showing
1 changed file
with
25 additions
and
0 deletions
Show diff stats
spec/controllers/problems_controller_spec.rb
| @@ -123,6 +123,31 @@ describe ProblemsController do | @@ -123,6 +123,31 @@ describe ProblemsController do | ||
| 123 | end | 123 | end |
| 124 | end | 124 | end |
| 125 | 125 | ||
| 126 | + describe "GET /problems/search" do | ||
| 127 | + before do | ||
| 128 | + sign_in Fabricate(:admin) | ||
| 129 | + @app = Fabricate(:app) | ||
| 130 | + @problem1 = Fabricate(:problem, :app=>@app, message: "Most important") | ||
| 131 | + @problem2 = Fabricate(:problem, :app=>@app, message: "Very very important") | ||
| 132 | + end | ||
| 133 | + | ||
| 134 | + it "renders successfully" do | ||
| 135 | + get :search | ||
| 136 | + expect(response).to be_success | ||
| 137 | + end | ||
| 138 | + | ||
| 139 | + it "renders index template" do | ||
| 140 | + get :search | ||
| 141 | + expect(response).to render_template('problems/index') | ||
| 142 | + end | ||
| 143 | + | ||
| 144 | + it "searches problems for given string" do | ||
| 145 | + get :search, :search => "Most important" | ||
| 146 | + expect(controller.problems).to include(@problem1) | ||
| 147 | + expect(controller.problems).to_not include(@problem2) | ||
| 148 | + end | ||
| 149 | + end | ||
| 150 | + | ||
| 126 | describe "GET /apps/:app_id/problems/:id" do | 151 | describe "GET /apps/:app_id/problems/:id" do |
| 127 | #render_views | 152 | #render_views |
| 128 | 153 |