-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1431173
commit e4180c7
Showing
4 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require 'rake' | ||
require 'rspec/core/rake_task' | ||
|
||
RSpec::Core::RakeTask.new(:spec) | ||
|
||
task :default => :spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
require "spec_helper" | ||
require 'embedda' | ||
|
||
describe "Embedda" do | ||
context "Youtube-link" do | ||
before(:all) do | ||
@embed_string = '<iframe width="560" height="315" src="http://www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" allowfullscreen></iframe>' | ||
end | ||
|
||
it "should embed when text have a link" do | ||
story = "http://www.youtube.com/watch?v=dQw4w9WgXcQ".embedda | ||
expect(story).to eq(@embed_string) | ||
end | ||
|
||
it "should embed when also other text is present around link" do | ||
story = "Hello, my name is Kasper: http://www.youtube.com/watch?v=dQw4w9WgXcQ <br/>And I am embedding links".embedda | ||
expect(story).to eq("Hello, my name is Kasper: #{@embed_string} <br/>And I am embedding links") | ||
end | ||
|
||
it "should embed when text include anchor tag to Youtube" do | ||
story = "<a href=\"http://www.youtube.com/watch?v=dQw4w9WgXcQ\">Look here for HalfLife3!</a>".embedda | ||
expect(story).to eq(@embed_string) | ||
end | ||
|
||
it "should embed when also other text is present around anchor tag" do | ||
story = "Hello, my name is Kasper: <a href=\"http://www.youtube.com/watch?v=dQw4w9WgXcQ\">Look here for HalfLife3!</a> <br/>And I am embedding links".embedda | ||
expect(story).to eq("Hello, my name is Kasper: #{@embed_string} <br/>And I am embedding links") | ||
end | ||
end | ||
|
||
context "Vimeo-link" do | ||
before(:all) do | ||
@embed_string = "<iframe src=\"http://player.vimeo.com/video/20241459\" width=\"500\" height=\"281\" frameborder=\"0\" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>" | ||
end | ||
|
||
it "should embed when text have a link" do | ||
story = "http://vimeo.com/20241459".embedda | ||
expect(story).to eq(@embed_string) | ||
end | ||
|
||
it "should embed when also other text is present around link" do | ||
story = "Hello, my name is Kasper: http://vimeo.com/20241459 <br/>And I am embedding links".embedda | ||
expect(story).to eq("Hello, my name is Kasper: #{@embed_string} <br/>And I am embedding links") | ||
end | ||
|
||
it "should embed when text include anchor tag to Youtube" do | ||
story = "<a href=\"http://vimeo.com/20241459\">Look here for HalfLife3!</a>".embedda | ||
expect(story).to eq(@embed_string) | ||
end | ||
|
||
it "should embed when also other text is present around anchor tag" do | ||
story = "Hello, my name is Kasper: <a href=\"http://vimeo.com/20241459\">Look here for HalfLife3!</a> <br/>And I am embedding links".embedda | ||
expect(story).to eq("Hello, my name is Kasper: #{@embed_string} <br/>And I am embedding links") | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# This file was generated by the `rspec --init` command. Conventionally, all | ||
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. | ||
# Require this file using `require "spec_helper"` to ensure that it is only | ||
# loaded once. | ||
# | ||
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration | ||
require 'rubygems' | ||
require 'bundler/setup' | ||
|
||
RSpec.configure do |config| | ||
config.treat_symbols_as_metadata_keys_with_true_values = true | ||
config.run_all_when_everything_filtered = true | ||
config.filter_run :focus | ||
|
||
# Run specs in random order to surface order dependencies. If you find an | ||
# order dependency and want to debug it, you can fix the order by providing | ||
# the seed, which is printed after each run. | ||
# --seed 1234 | ||
config.order = 'random' | ||
end |