Sha256: 45aaff55687158b75518ba066bd9981d1395602fc586982c88c26cea86cd33d7

Contents?: true

Size: 1.22 KB

Versions: 48

Compression:

Stored size: 1.22 KB

Contents

$:.unshift(File.dirname(__FILE__))
require 'spec_helper'

describe "github link plugin" do
	let(:plugin) { fake_plugin(:github_link) }
	subject { plugin.gh_link(*args) }

	describe 'repository page' do
		let(:args) { ['tdiary/tdiary-contrib'] }

		it 'should render repository a tag' do
			is_expected.to eq(%(<a href='https://github.com/tdiary/tdiary-contrib'>tdiary-contrib</a>))
		end
	end

	describe 'issues page' do
		let(:args) { ['tdiary/tdiary-contrib#100'] }

		it 'should render issues a tag' do
			is_expected.to eq(%(<a href='https://github.com/tdiary/tdiary-contrib/issues/100'>tdiary-contrib#100</a>))
		end
	end
  context "When given altenative text" do
    let(:text) { 'This project' }
    let(:github_identifier) { 'tdiary/tdiary-contrib' }
    let(:args) { [github_identifier, text] }

		it 'should render repository a tag with the specified text' do
			is_expected.to eq(%(<a href='https://github.com/#{github_identifier}'>#{text}</a>))
		end
    context "but the text is including <script>" do
      let(:text) { '<script>alert("hoge");</script>' }

      it 'should render a link text after sanitizing.' do
        is_expected.not_to eq(%(<a href='https://github.com/#{github_identifier}'>#{text}</a>))
      end
    end
  end
end

Version data entries

48 entries across 42 versions & 2 rubygems

Version Path
tdiary-contrib-5.3.0 spec/github_link_spec.rb
tdiary-contrib-5.2.4 spec/github_link_spec.rb
tdiary-contrib-5.2.3 spec/github_link_spec.rb
tdiary-contrib-5.2.2 spec/github_link_spec.rb
tdiary-contrib-5.2.1 spec/github_link_spec.rb
tdiary-contrib-5.2.0 spec/github_link_spec.rb
tdiary-contrib-5.1.7 spec/github_link_spec.rb
tdiary-contrib-5.1.6 spec/github_link_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-contrib-5.1.4/spec/github_link_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/bundler/gems/tdiary-contrib-d1e41204db13/spec/github_link_spec.rb
tdiary-contrib-5.1.5 spec/github_link_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-contrib-5.1.4/spec/github_link_spec.rb
tdiary-contrib-5.1.4 spec/github_link_spec.rb
tdiary-contrib-5.1.3 spec/github_link_spec.rb
tdiary-contrib-5.1.2 spec/github_link_spec.rb
tdiary-contrib-5.1.1 spec/github_link_spec.rb
tdiary-contrib-5.1.0 spec/github_link_spec.rb
tdiary-contrib-5.0.13 spec/github_link_spec.rb
tdiary-contrib-5.0.12 spec/github_link_spec.rb
tdiary-contrib-5.0.11 spec/github_link_spec.rb