docbrown/spec/models/device_spec.rb
rhymes cf9f6094cd
Have specs run without Redis and refactor ConsumerApp and Device (#13647)
* Add fakeredis gem

* Mock Pusher::PushNotifications in specs

* Remove Redis from Travis

* Add Android tests to ConsumerApp specs

* Use mock for push notification tests and refactor ConsumerApp and Device code

* Fix remaining broken specs

* Use symbols

* Cleanup rpush helpers

* Pusher::PushNotifications is no more

* Use human friendly platform in Admin::ConsumerApps index page
2021-05-07 08:03:16 +02:00

17 lines
470 B
Ruby

require "rails_helper"
RSpec.describe Device, type: :model do
let(:device) { create(:device) }
describe "validations" do
subject { device }
describe "builtin validations" do
it { is_expected.to belong_to(:consumer_app) }
it { is_expected.to belong_to(:user) }
it { is_expected.to validate_presence_of(:token) }
it { is_expected.to validate_uniqueness_of(:token).scoped_to(%i[user_id platform consumer_app_id]) }
end
end
end