* Create more request specs * Update wording * Update guard to work with requests * Fix broken spec * Remove rails-controller-testing gem * Move article_specs * Move last controller spec out * Remove controller spec config * Fix broken spec * Remove all use of render_template * Refactor spec * Tweak User#remember_me * Create ArticleAnalyticFetcher spec * Undo User#remember_me * Use srand in rspec * Create FeedbackMessagesHelper spec * Add DigestMailer spec * Fix broken test
26 lines
694 B
Ruby
26 lines
694 B
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe "AsyncInfo", type: :request do
|
|
describe "GET /async_info/base_data" do
|
|
context "when not logged-in" do
|
|
before { get "/async_info/base_data" }
|
|
|
|
it "returns token" do
|
|
expect(response.body).to include("token")
|
|
end
|
|
|
|
it "does not return user" do
|
|
expect(response.body).not_to include("user")
|
|
end
|
|
end
|
|
|
|
context "when logged int" do
|
|
it "returns token and user" do
|
|
allow(cookies).to receive(:[]).with(:remember_user_token).and_return(nil)
|
|
sign_in create(:user)
|
|
get "/async_info/base_data"
|
|
expect(response.body).to include("token", "user")
|
|
end
|
|
end
|
|
end
|
|
end
|