forked from mlpinit/bootleg
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
5 changed files
with
102 additions
and
0 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,2 @@ | ||
--color | ||
--format documentation |
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,59 @@ | ||
require 'spec_helper' | ||
|
||
describe Extractor do | ||
it "should raise an error withouth arguments" do | ||
expect{ Extractor.new }.to raise_error(ArgumentError) | ||
end | ||
|
||
it "should not raise error with one argument" do | ||
expect { Extractor.new("http://www.moviefone.com")}.to_not raise_error(ArgumentError) | ||
end | ||
|
||
it "should raise an error with more then one argument" do | ||
expect { Extractor.new("arg1", "arg2") }.to raise_error(ArgumentError) | ||
end | ||
|
||
before :all do | ||
@theaters = Extractor.new("http://www.moviefone.com/showtimes/manchester-md/21102/theaters").page_theaters | ||
end | ||
|
||
it "should pull out no more then 5 theaters" do | ||
@theaters.size.should eq(5) | ||
end | ||
|
||
describe Theater do | ||
before :all do | ||
@theater = @theaters[1] | ||
end | ||
|
||
it "name should match expression" do | ||
expect(@theater[:name]).to match(/(\w|\s)/) | ||
end | ||
|
||
it "href should be a link" do | ||
expect(@theater[:href]).to match(/http:\/\/www\.moviefone\.com/) | ||
end | ||
|
||
describe Movie do | ||
|
||
before :all do | ||
@movie = @theater[:movies].first | ||
end | ||
it "should have a name, href and showtimes" do | ||
expect(@movie.size).to eq(3) | ||
end | ||
|
||
it "name should match expression" do | ||
expect(@movie[:name]).to match(/(\w|\s)/) | ||
end | ||
|
||
it "href shoud mathc expression" do | ||
expect(@movie[:href]).to match(/http:\/\/www\.moviefone\.com/) | ||
end | ||
|
||
it "shotimes returns an array" do | ||
expect(@movie[:showtimes].class).to be(Array) | ||
end | ||
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,26 @@ | ||
require 'spec_helper' | ||
|
||
describe Finder do | ||
it "should raise an error with no arguments" do | ||
expect { Finder.new }.to raise_error(ArgumentError) | ||
end | ||
|
||
it "should not raise error with one argument" do | ||
expect { Finder.new("smth") }.to_not raise_error(ArgumentError) | ||
end | ||
|
||
it "should raise an error with more then one arguments" do | ||
expect { Finder.new("smth", "smthelse") }.to raise_error(ArgumentError) | ||
end | ||
|
||
|
||
describe Href do | ||
before :all do | ||
@hrefs = Finder.new('21102').hrefs | ||
end | ||
|
||
it "should have a size of 3" do | ||
expect(@hrefs.size).to eq(3) | ||
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,7 @@ | ||
require 'spec_helper' | ||
|
||
describe Presenter do | ||
it "should not work" do | ||
pending 'to be continued...' | ||
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,8 @@ | ||
require 'rubygems' | ||
require 'bundler/setup' | ||
|
||
require 'bootleg' | ||
|
||
RSpec.configure do |config| | ||
#optional | ||
end |