Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to RSpec 3 conventions and syntax #71

Merged
merged 1 commit into from May 27, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion imdb.gemspec
Expand Up @@ -22,7 +22,7 @@ Gem::Specification.new do |s|
s.add_dependency 'nokogiri', '= 1.6.5'

s.add_development_dependency 'rake', '~> 10.0.3'
s.add_development_dependency 'rspec', '~> 2.13.0'
s.add_development_dependency 'rspec', '~> 3.0.0'
s.add_development_dependency 'gokdok'
s.add_development_dependency 'rdoc', '~> 4.0'
s.add_development_dependency 'fakeweb'
Expand Down
21 changes: 10 additions & 11 deletions spec/imdb/box_office_spec.rb
@@ -1,21 +1,20 @@
require 'spec_helper'

describe Imdb::BoxOffice do
before(:each) do
@movies = Imdb::BoxOffice.new.movies
end
subject { Imdb::BoxOffice.new.movies }

it 'should be a list of movies' do
@movies.each { |movie| movie.should be_an_instance_of(Imdb::Movie) }
it 'is list of movies' do
subject.each do |movie|
expect(movie).to be_a(Imdb::Movie)
end
end

it 'should return the box office movies from IMDB.com' do
@movies.size.should eq(10)
it 'returns the box office movies from IMDB.com' do
expect(subject.length).to eq(10)
end

it 'should provide array like access to the movies' do
@movies[0].title.should eq('Big Hero 6')
@movies[1].title.should eq('Interstellar')
@movies[2].title.should eq('Gone Girl')
it 'is an array like access to the movies' do
expected_movies = ['Big Hero 6', 'Interstellar', 'Gone Girl']
expect(subject.map(&:title)).to include(*expected_movies)
end
end
22 changes: 10 additions & 12 deletions spec/imdb/episode_spec.rb
@@ -1,37 +1,35 @@
require 'spec_helper'

describe 'Imdb::Episode' do
before(:each) do
@serie = Imdb::Serie.new('1520211')
@season = @serie.seasons.first
@episode = @season.episode(2)
end
let(:serie) { Imdb::Serie.new('1520211') }
let(:season) { serie.seasons.first }
let(:episode) { season.episode(2) }

it 'has a imdb_id' do
@episode.id.should == '1628064'
expect(episode.id).to eq('1628064')
end

it 'has a url' do
@episode.url.should == 'http://akas.imdb.com/title/tt1628064/combined'
expect(episode.url).to eq('http://akas.imdb.com/title/tt1628064/combined')
end

it 'has an episode title' do
@episode.title.should =~ /Guts/i
expect(episode.title).to match(/Guts/i)
end

it 'has the season number' do
@episode.season.should == 1
expect(episode.season).to eq(1)
end

it 'has the episode number' do
@episode.episode.should == 2
expect(episode.episode).to eq(2)
end

it 'has a plot' do
@episode.plot.should =~ /Rick finds himself trapped with other survivors inside a department store, surrounded by walkers/
expect(episode.plot).to match(/Rick finds himself trapped with other survivors inside a department store, surrounded by walkers/)
end

it 'has a original air data' do
@episode.air_date.should eql('7 November 2010')
expect(episode.air_date).to eq('7 November 2010')
end
end