docbrown/spec/requests/history_spec.rb
rhymes 2bf54edb9c Pro: History (#3220)
* Add base history support

* Add tags and ranking and make it work

* Fix styling

* Add article title and text excerpt to the index

* Add pagination support

* Debounce the search to 300ms

* Show history only to pro users

* Use routing helpers instead of hardcoding

* Raise the page size to 100

* Remove console log

* A bit of regrouping
2019-06-18 14:58:24 -04:00

20 lines
529 B
Ruby

require "rails_helper"
RSpec.describe "History", type: :request do
let(:user) { create(:user) }
let(:pro_user) { create(:user, :pro) }
describe "GET /history" do
it "does not allow access to a regular user" do
sign_in user
expect { get history_path }.to raise_error(Pundit::NotAuthorizedError)
end
it "allows access to a pro user" do
sign_in pro_user
get history_path
expect(response).to have_http_status(:ok)
expect(response.body).to include("History")
end
end
end