|
| 1 | +require "spec_helper" |
| 2 | +require "requests_helper" |
| 3 | + |
| 4 | +describe PeopleController, type: :request do |
| 5 | + context "for the current user" do |
| 6 | + before do |
| 7 | + login alice |
| 8 | + end |
| 9 | + |
| 10 | + it "displays the publisher for user profile path" do |
| 11 | + get "/u/#{alice.username}" |
| 12 | + |
| 13 | + expect(response.status).to eq(200) |
| 14 | + # make sure we are signed in |
| 15 | + expect(response.body).not_to match(/a class="login"/) |
| 16 | + expect(response.body).to match(/div id='publisher_textarea_wrapper'/) |
| 17 | + end |
| 18 | + |
| 19 | + it "displays the publisher for people path" do |
| 20 | + get "/people/#{alice.person.guid}" |
| 21 | + |
| 22 | + expect(response.status).to eq(200) |
| 23 | + # make sure we are signed in |
| 24 | + expect(response.body).not_to match(/a class="login"/) |
| 25 | + expect(response.body).to match(/div id='publisher_textarea_wrapper'/) |
| 26 | + end |
| 27 | + end |
| 28 | + |
| 29 | + context "for another user" do |
| 30 | + before do |
| 31 | + login bob |
| 32 | + end |
| 33 | + |
| 34 | + it "doesn't display the publisher for user profile path" do |
| 35 | + get "/u/#{alice.username}" |
| 36 | + |
| 37 | + expect(response.status).to eq(200) |
| 38 | + # make sure we are signed in |
| 39 | + expect(response.body).not_to match(/a class="login"/) |
| 40 | + expect(response.body).not_to match(/div id='publisher_textarea_wrapper'/) |
| 41 | + end |
| 42 | + |
| 43 | + it "doesn't display the publisher for people path" do |
| 44 | + get "/people/#{alice.person.guid}" |
| 45 | + |
| 46 | + expect(response.status).to eq(200) |
| 47 | + # make sure we are signed in |
| 48 | + expect(response.body).not_to match(/a class="login"/) |
| 49 | + expect(response.body).not_to match(/div id='publisher_textarea_wrapper'/) |
| 50 | + end |
| 51 | + end |
| 52 | + |
| 53 | + context "with no user signed in" do |
| 54 | + it "doesn't display the publisher for user profile path" do |
| 55 | + get "/u/#{alice.username}" |
| 56 | + |
| 57 | + expect(response.status).to eq(200) |
| 58 | + # make sure we aren't signed in |
| 59 | + expect(response.body).to match(/a class="login"/) |
| 60 | + expect(response.body).not_to match(/div id='publisher_textarea_wrapper'/) |
| 61 | + end |
| 62 | + |
| 63 | + it "doesn't display the publisher for people path" do |
| 64 | + get "/people/#{alice.person.guid}" |
| 65 | + |
| 66 | + expect(response.status).to eq(200) |
| 67 | + # make sure we aren't signed in |
| 68 | + expect(response.body).to match(/a class="login"/) |
| 69 | + expect(response.body).not_to match(/div id='publisher_textarea_wrapper'/) |
| 70 | + end |
| 71 | + end |
| 72 | +end |
0 commit comments