# encoding: utf-8 require 'spec_helper' describe 'micro' do before do @api = Prismic.api('https://micro.prismic.io/api', nil) @master_ref = @api.master_ref @link_resolver = Prismic.link_resolver('master'){|doc_link| "http://localhost/#{doc_link.id}" } end describe 'embed block in structured text fragments' do it 'is of the right Embed object, and serializes well' do fragment = @api.form('everything').query(%w(at document.id UrjI1gEAALOCeO5i)).submit(@master_ref)[0]['article.body'] fragment.blocks[4].is_a?(Prismic::Fragments::Embed).should == true fragment.as_html(@link_resolver).gsub(/[\n\r]+/, '').gsub(/ +/, ' ').gsub(/'/, "'").should == %(
This is where you go to give feedback, and discuss the future of micro. Subscribe to the list now!
This is where you get truly active, by forking the project's source code, and making it better. Please always feel free to send us pull requests.
If you think micro isn't working properly in one of its features, open a new issue in the micro GitHub repository.
Feel free to ask a new question on StackOverflow.
) end end describe 'linked documents' do it 'should have linked documents' do response = @api.form('everything').query('[[:d = any(document.type, ["doc","docchapter"])]]').submit(@master_ref) linked_documents = response.results[0].linked_documents linked_documents.count.should == 1 linked_documents[0].id.should == 'U0w8OwEAACoAQEvB' end end end