Skip to content

Commit

Permalink
[ci] Specs for RssTokenController
Browse files Browse the repository at this point in the history
  • Loading branch information
Moises Deniz Aleman authored and hennevogel committed Jun 29, 2017
1 parent 40b2080 commit 4bb2d59
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/api/spec/controllers/webui/users/rss_token_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
require 'rails_helper'

RSpec.describe Webui::Users::RssTokensController do
describe 'POST #create' do
let(:user) { create(:confirmed_user) }

before do
login(user)
end

context 'with a user with an existent token' do
before do
@last_token = user.create_rss_token.string
post :create
end

it { expect(flash[:success]).to eq("Successfully re-generated your RSS feed url") }
it { is_expected.to redirect_to(user_notifications_path) }
it { expect(user.reload.rss_token.string).not_to eq(@last_token) }
end

context 'with a user without a token' do
before do
@last_token = user.rss_token
post :create
end

it { expect(flash[:success]).to eq("Successfully generated your RSS feed url") }
it { is_expected.to redirect_to(user_notifications_path) }
it { expect(user.reload.rss_token).not_to be_nil }
it { expect(@last_token).to be_nil }
end
end
end

0 comments on commit 4bb2d59

Please sign in to comment.