Skip to content

Commit

Permalink
Added tests for Custom Events
Browse files Browse the repository at this point in the history
  • Loading branch information
cmengler committed Apr 16, 2018
1 parent ffb82d4 commit 2c96510
Show file tree
Hide file tree
Showing 7 changed files with 1,895 additions and 0 deletions.
46 changes: 46 additions & 0 deletions spec/lib/fabricio/networking/app_request_model_factory_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
require 'fabricio/networking/app_request_model_factory'
require 'fabricio/networking/request_model'
require 'fabricio/authorization/session'
require 'fabricio/authorization/memory_param_storage'

describe 'AppRequestModelFactory' do

Expand Down Expand Up @@ -137,4 +138,49 @@
expect(result.api_path).not_to be_nil
expect(result.headers).not_to be_nil
end

it 'should form all custom event request model' do
result = @factory.all_custom_event_request_model

expect(result.type).to eq :GET
expect(result.base_url).not_to be_nil
expect(result.api_path).not_to be_nil
expect(result.headers).not_to be_nil
end

it 'should form custom event total request model' do
result = @factory.custom_event_total_request_model(event_type: 'Custom Event Name')

expect(result.type).to eq :GET
expect(result.base_url).not_to be_nil
expect(result.api_path).not_to be_nil
expect(result.headers).not_to be_nil
end

it 'should form custom event unique devices request model' do
result = @factory.custom_event_unique_devices_request_model(event_type: 'Custom Event Name')

expect(result.type).to eq :GET
expect(result.base_url).not_to be_nil
expect(result.api_path).not_to be_nil
expect(result.headers).not_to be_nil
end

it 'should form all custom event attribute request model' do
result = @factory.all_custom_event_attribute_request_model(event_type: 'Custom Event Name')

expect(result.type).to eq :GET
expect(result.base_url).not_to be_nil
expect(result.api_path).not_to be_nil
expect(result.headers).not_to be_nil
end

it 'should form custom event attribute request model' do
result = @factory.custom_event_attribute_request_model(event_type: 'Custom Event Name', event_attribute: 'Custom Attribute', selected_time: 1523800800)

expect(result.type).to eq :GET
expect(result.base_url).not_to be_nil
expect(result.api_path).not_to be_nil
expect(result.headers).not_to be_nil
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"event_type":"Custom Event Name 1",
"start":1521158400,
"attribute_metadata":[
{
"attribute_type":"category",
"attribute_name":"Custom Attribute Name 1"
},
{
"attribute_type":"category",
"attribute_name":"Custom Attribute Name 2"
}
],
"end":1523750400,
"app_id":"app_id"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"custom_events":[
{
"event_type":"Custom Event Name 1",
"event_count":52,
"event_key":"custom"
},
{
"event_type":"Custom Event Name 2",
"event_count":16,
"event_key":"custom"
},
{
"event_type":"Custom Event Name 3",
"event_count":8,
"event_key":"custom"
},
{
"event_type":"Custom Event Name 4",
"event_count":9,
"event_key":"custom"
}
],
"start":1521158400,
"end":1523750400,
"app_id":"app_id",
"predefined_events":[

]
}
Loading

0 comments on commit 2c96510

Please sign in to comment.