Sha256: 0a08fdc0499842cc0a0b03bc1c01782646a044be821d4d69ecc0c6ad7113bbd3
Contents?: true
Size: 813 Bytes
Versions: 1
Compression:
Stored size: 813 Bytes
Contents
# frozen_string_literal: true describe PUNK::ListSessionsAction do context "with no user provided" do it "returns a validation error" do view = described_class.run.result.render(:json) expect(view).to match("user is not present") end end context "with a user provided" do let(:user) { create(:user) } let(:identity) { create(:identity, user: user) } before do create_list(:session, 3, state: "active") create_list(:session, 3, state: "active", identity: identity) end it "returns active sessions that the user belongs to" do expect(PUNK::Session.count).to eq(6) view = JSON.parse(described_class.run(user: user).result.render(:json)) expect(view.map { |h| h["id"] }.sort).to eq(user.active_sessions.map(&:id).sort) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
punk-0.4.1 | spec/actions/sessions/punk/list_sessions_action_spec.rb |