Skip to content

Commit f390ea3

Browse files
committed
Revive teams controller specs
1 parent 71e19f2 commit f390ea3

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

spec/controllers/teams_controller_spec.rb

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
require 'spec_helper'
22

3-
RSpec.describe TeamsController, type: :controller, skip: true do
3+
RSpec.describe TeamsController, type: :controller do
44
let(:current_user) { Fabricate(:user) }
55
let(:team) { Fabricate(:team) }
66

77
before { controller.send :sign_in, current_user }
88

99
it 'allows user to follow team' do
10-
post :follow, id: team.id
10+
pending "Fix User#follow_team first"
11+
post :follow, id: team.id, format: :js
12+
13+
expect(response).to be_success
14+
current_user.reload
1115
expect(current_user.following_team?(team)).to eq(true)
1216
end
1317

1418
it 'allows user to stop follow team' do
19+
pending "Fix User#follow_team first"
1520
current_user.follow_team!(team)
21+
current_user.reload
22+
expect(current_user.following_team?(team)).to eq(true)
1623
post :follow, id: team.id
1724
current_user.reload
1825
expect(current_user.following_team?(team)).to eq(false)
@@ -27,6 +34,12 @@
2734
end
2835

2936
describe 'GET #show' do
37+
before do
38+
url = 'http://maps.googleapis.com/maps/api/geocode/json?address=San%20Francisco,%20CA&language=en&sensor=false'
39+
@body ||= File.read(File.join(Rails.root, 'spec', 'fixtures', 'google_maps.json'))
40+
stub_request(:get, url).to_return(body: @body)
41+
end
42+
3043
it 'responds successfully with an HTTP 200 status code' do
3144
team = Fabricate(:team) do
3245
name Faker::Company.name
@@ -36,11 +49,13 @@
3649
expect(response).to be_success
3750
expect(response).to have_http_status(200)
3851
end
52+
3953
it 'sets job_page to true if job is found' do
40-
opporunity = Fabricate(:opportunity)
54+
opportunity = Fabricate(:opportunity)
4155
get :show, slug: opportunity.team.slug, job_id: opportunity.public_id
4256
expect(assigns(:job_page)).to eq(true)
4357
end
58+
4459
it 'sets job_page to false if job is not found' do
4560
team = Fabricate(:team)
4661
get :show, slug: team.slug, job_id: 'not-a-real-job-slug'
@@ -85,7 +100,7 @@
85100
end
86101

87102
it 'adds current user to the team' do
88-
expect(team).to receive(:add_user).with(current_user)
103+
expect(team).to receive(:add_user).with(current_user, 'active', 'admin')
89104
response
90105
end
91106

0 commit comments

Comments
 (0)