mirror of
http://ghproxy.cn/https://github.com/multunus/onemdm-server
synced 2025-12-06 02:04:57 +00:00
Add GCM push for pushing OneMDM app to devices
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
FactoryGirl.define do
|
||||
factory :app do
|
||||
name "My Ultimate Application"
|
||||
package_name "my.ultimate.application"
|
||||
name "One MDM"
|
||||
package_name "com.multunus.onemdm"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
FactoryGirl.define do
|
||||
factory :batch_installation do
|
||||
app_id 1
|
||||
association :app
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
FactoryGirl.define do
|
||||
factory :installation do
|
||||
device_id 1
|
||||
batch_installation_id 1
|
||||
status 1
|
||||
association :device
|
||||
association :batch_installation
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe App, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
|
||||
let!(:app) { create(:app) }
|
||||
|
||||
it { should validate_presence_of :name }
|
||||
it { should validate_presence_of :package_name }
|
||||
|
||||
end
|
||||
@@ -4,11 +4,12 @@ RSpec.describe Installation, type: :model do
|
||||
it { should belong_to(:device) }
|
||||
it { should belong_to(:batch_installation) }
|
||||
|
||||
|
||||
|
||||
# Create Installation Model [Device ID, batch installation ID, status(Pushed, Downloaded, Cancelled, Installed)]
|
||||
describe "Installation status" do
|
||||
let!(:installation){FactoryGirl.create(:installation)}
|
||||
it "Default status" do
|
||||
expect(installation.status).to eql Installation.statuses.keys[0]
|
||||
end
|
||||
it "Pushed" do
|
||||
installation.pushed!
|
||||
expect(installation.status).to eql Installation.statuses.keys[0]
|
||||
@@ -29,4 +30,17 @@ RSpec.describe Installation, type: :model do
|
||||
|
||||
end
|
||||
|
||||
describe "GCM Push " do
|
||||
let(:installation){FactoryGirl.build(:installation)}
|
||||
|
||||
it "if status is pushed" do
|
||||
expect_any_instance_of(GCM).to receive(:send).and_return(installation)
|
||||
installation.save
|
||||
end
|
||||
it "status is not pushed" do
|
||||
expect_any_instance_of(GCM).not_to receive(:send)
|
||||
installation.cancelled!
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user