mirror of
https://github.com/nov/fb_graph2
synced 2023-03-27 23:22:15 -04:00
rename 'class' to 'klass' and more app_links specs
This commit is contained in:
parent
140c52cf5c
commit
1d21e422e6
3 changed files with 80 additions and 2 deletions
|
@ -18,8 +18,16 @@ module FbGraph2
|
|||
|
||||
class Android < Native
|
||||
register_attributes(
|
||||
raw: [:class, :package]
|
||||
raw: [:package],
|
||||
custom: [:klass]
|
||||
)
|
||||
|
||||
def initialize(attributes = {})
|
||||
super
|
||||
if attributes.include? :class
|
||||
self.klass = attributes[:class]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class WindowsPhone < Native
|
||||
|
|
70
spec/fb_graph2/app_link_host_spec.rb
Normal file
70
spec/fb_graph2/app_link_host_spec.rb
Normal file
|
@ -0,0 +1,70 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe FbGraph2::AppLinkHost do
|
||||
let(:app_link_host) do
|
||||
FbGraph2::AppLinkHost.new(
|
||||
'host_id',
|
||||
name: 'Sample',
|
||||
canonical_url: 'https://fb.me/804327549686491',
|
||||
ios: [{
|
||||
app_name: 'Sample iOS',
|
||||
app_store_id: 'ios.sample.fb_graph2',
|
||||
url: 'fbgraph2://ios'
|
||||
}],
|
||||
iphone: [{
|
||||
app_name: 'Sample iPhone',
|
||||
app_store_id: 'iphone.sample.fb_graph2',
|
||||
url: 'fbgraph2://iphone'
|
||||
}],
|
||||
android: [{
|
||||
app_name: 'Sample Android',
|
||||
class: 'FbGraph2',
|
||||
package: 'android.sample.fb_graph2',
|
||||
url: 'fbgraph2://android'
|
||||
}],
|
||||
windows_phone: [{
|
||||
app_name: 'Sample WindowsPhone',
|
||||
app_id: 'windows_phone.sample.fb_graph2',
|
||||
url: 'fbgraph2://windows_phone'
|
||||
}],
|
||||
web: {
|
||||
should_fallback: true,
|
||||
url: 'https://fbgraphsample.herokuapp.com/app_links/sample'
|
||||
}
|
||||
)
|
||||
end
|
||||
subject { app_link_host }
|
||||
|
||||
its(:id) { should == 'host_id' }
|
||||
its(:name) { should == 'Sample' }
|
||||
its(:canonical_url) { should == 'https://fb.me/804327549686491' }
|
||||
|
||||
describe 'iOS' do
|
||||
subject { app_link_host.ios.first }
|
||||
its(:app_name) { should == 'Sample iOS' }
|
||||
its(:app_store_id) { should == 'ios.sample.fb_graph2' }
|
||||
its(:url) { should == 'fbgraph2://ios' }
|
||||
end
|
||||
|
||||
describe 'iPhone' do
|
||||
subject { app_link_host.iphone.first }
|
||||
its(:app_name) { should == 'Sample iPhone' }
|
||||
its(:app_store_id) { should == 'iphone.sample.fb_graph2' }
|
||||
its(:url) { should == 'fbgraph2://iphone' }
|
||||
end
|
||||
|
||||
describe 'Android' do
|
||||
subject { app_link_host.android.first }
|
||||
its(:app_name) { should == 'Sample Android' }
|
||||
its(:klass) { should == 'FbGraph2' }
|
||||
its(:package) { should == 'android.sample.fb_graph2' }
|
||||
its(:url) { should == 'fbgraph2://android' }
|
||||
end
|
||||
|
||||
describe 'WindowsPhone' do
|
||||
subject { app_link_host.windows_phone.first }
|
||||
its(:app_name) { should == 'Sample WindowsPhone' }
|
||||
its(:app_id) { should == 'windows_phone.sample.fb_graph2' }
|
||||
its(:url) { should == 'fbgraph2://windows_phone' }
|
||||
end
|
||||
end
|
|
@ -13,7 +13,7 @@ describe FbGraph2::Struct::AppLink do
|
|||
end
|
||||
|
||||
describe FbGraph2::Struct::AppLink::Native::Android do
|
||||
its(:registered_attributes) { should == {raw: [:url, :app_name, :class, :package]} }
|
||||
its(:registered_attributes) { should == {raw: [:url, :app_name, :package], custom: [:klass]} }
|
||||
end
|
||||
|
||||
describe FbGraph2::Struct::AppLink::Native::WindowsPhone do
|
||||
|
|
Loading…
Reference in a new issue