From b3f944a3983db179fdaee0a1f0618c94600be823 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Wed, 11 Feb 2015 18:08:53 -0800 Subject: Annotate services. Add a link to service template. --- spec/models/service_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'spec') diff --git a/spec/models/service_spec.rb b/spec/models/service_spec.rb index c96f2b20529..10cbafebd95 100644 --- a/spec/models/service_spec.rb +++ b/spec/models/service_spec.rb @@ -5,11 +5,12 @@ # id :integer not null, primary key # type :string(255) # title :string(255) -# project_id :integer not null +# project_id :integer # created_at :datetime # updated_at :datetime # active :boolean default(FALSE), not null # properties :text +# template :boolean default(FALSE) # require 'spec_helper' -- cgit v1.2.1 From 378520bd8be0a23510c9beea5987e10343194fb5 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Thu, 12 Feb 2015 10:53:01 -0800 Subject: Add a test for service template. --- spec/models/service_spec.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'spec') diff --git a/spec/models/service_spec.rb b/spec/models/service_spec.rb index 10cbafebd95..1df34f56cf1 100644 --- a/spec/models/service_spec.rb +++ b/spec/models/service_spec.rb @@ -60,4 +60,29 @@ describe Service do end end end + + describe "Template" do + describe "for pushover service" do + let(:service_template) { + PushoverService.create(template: true, properties: {device: 'MyDevice', sound: 'mic', priority: 4, api_key: '123456789'}) + } + let(:project) { create(:project) } + + describe 'should be prefilled for projects pushover service' do + before do + service_template + project.build_missing_services + end + + it "should have all fields prefilled" do + service = project.pushover_service + expect(service.template).to eq(false) + expect(service.device).to eq('MyDevice') + expect(service.sound).to eq('mic') + expect(service.priority).to eq(4) + expect(service.api_key).to eq('123456789') + end + end + end + end end -- cgit v1.2.1