Sha256: ba55260bf6859fd5a2da70307fd21e34452bbaec4c577aab0410384d6082203c
Contents?: true
Size: 1.35 KB
Versions: 1
Compression:
Stored size: 1.35 KB
Contents
require 'spec_helper' require 'textp' describe Textp do it "should have a VERSION constant" do expect(subject.const_get('VERSION')).to_not be_empty end describe "Parser" do before(:each) do @text = "I have a link http://www.google.com" @parser = Parser.new(@text) end it "should output text" do expect(@parser.parse).to eq(@text) end it "should find urls in text" do expect(@parser.has_links?).to_not be(false) end it "should return links as json" do expect(@parser.links).to eq(["http://www.google.com"]) end end describe "HTML Helper" do before(:each) do @text = "I have a youtube link https://www.youtube.com/watch?v=9Nxq-5jt10Q" @html = HtmlHelper.new(@text) end context "Links" do it "should have a valid links array" do expect(@html.parser.links).to eq(["https://www.youtube.com/watch?v=9Nxq-5jt10Q"]) end it "should convert links to hash" do expected = {:links => ["https://www.youtube.com/watch?v=9Nxq-5jt10Q"]} expect(@html.links).to eq(expected) end end context "Html Replacement Content" do it "should replace links with html fetched from oembed api" do expect(@html.replacement_content).to_not eq("I have a youtube link https://www.youtube.com/watch?v=9Nxq-5jt10Q") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
textp-0.1.0 | spec/textp_spec.rb |