Repository URL to install this package:
Version:
2.23.0 ▾
|
require 'spec_helper'
describe JPlatform::ScheduledItem, :type => :model do
before(:each) do
#Header is instance so it can be reached in teh social_account before :each scope
@header = {content_type: "application/json; charset=utf-8"}
stub_get("/api/v1/scheduled_items/1.json").to_return(body: fixture("scheduled_item1.json"), headers: @header)
@item = JPlatform::ScheduledItem.find(1)
end
describe "Time accessors" do
it "parses Time from scheduled_time with scheduled_time" do
expect(@item.scheduled_time).to be_a Time
end
end
describe "options" do
it "contains message specific options" do
## TODO: Move the Post-specific stuff from here to a PostItem spec
return skip
expect(@item.options.has_key?(:message)).to be_truthy
expect(@item.options.has_key?(:social_account_id)).to be_truthy
expect(@item.options.has_key?(:options)).to be_truthy
end
end
describe "social_account" do
it "returns social account from attributes" do
expect(@item.social_account).to be_a_kind_of ::SocialAccount
expect(@item.social_account.id).to eq(6)
expect(a_get("/api/v1/social_accounts/7.json")).to_not have_been_made
end
end
end