Skip to content

Commit

Permalink
Merge pull request #7 from dougcole/add_tests
Browse files Browse the repository at this point in the history
adding tests!
  • Loading branch information
dougcole authored Apr 6, 2018
2 parents c1548c3 + bc2af67 commit 72bc84f
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 103 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: ruby
services:
- postgresql
before_script:
- psql -c "CREATE USER askthem SUPERUSER;" -U postgres
- psql -c 'create database "askthem-test";' -U askthem -d postgres
- bin/rails db:migrate RAILS_ENV=test

2 changes: 1 addition & 1 deletion config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ test:

production:
<<: *default
database: askthem-test
database: askthem-production
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

resources :questions, :only => [:index, :new, :create]
resources :votes, :only => :create
get 'search', to: 'search#index'
get 'search', to: 'search#index', as: :search
end
10 changes: 7 additions & 3 deletions test/controllers/search_controller_test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
require 'test_helper'

class SearchControllerTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
test "returns results from database" do
get search_url, params: {q: 'Washington'}
result = JSON.parse(response.body)
assert_equal result['results'].size, 1
assert_equal result['results'].first['text'],
"U.S. Representative - Washington's 4th congressional district"
end
end
9 changes: 4 additions & 5 deletions test/fixtures/contests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value
one:
name: U.S. Representative
electoral_district_name: Washington's 4th congressional district
electoral_district_type: congressional
11 changes: 0 additions & 11 deletions test/fixtures/questions.yml

This file was deleted.

11 changes: 0 additions & 11 deletions test/fixtures/techandciviclife/candidate_contests.yml

This file was deleted.

11 changes: 0 additions & 11 deletions test/fixtures/techandciviclife/candidate_selections.yml

This file was deleted.

11 changes: 0 additions & 11 deletions test/fixtures/techandciviclife/candidates.yml

This file was deleted.

11 changes: 0 additions & 11 deletions test/fixtures/techandciviclife/electoral_districts.yml

This file was deleted.

11 changes: 0 additions & 11 deletions test/fixtures/techandciviclife/offices.yml

This file was deleted.

11 changes: 0 additions & 11 deletions test/fixtures/techandciviclife/parties.yml

This file was deleted.

11 changes: 0 additions & 11 deletions test/fixtures/techandciviclife/people.yml

This file was deleted.

7 changes: 2 additions & 5 deletions test/fixtures/users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value
one:
email: [email protected]

0 comments on commit 72bc84f

Please sign in to comment.