spec/projects_spec.rb in ticketmaster-rally-0.1.2 vs spec/projects_spec.rb in ticketmaster-rally-0.2.2
- old
+ new
@@ -1,54 +1,60 @@
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "Ticketmaster::Provider::Rally::Project" do
before(:all) do
+ VCR.use_cassette('rally') do
+ @ticketmaster = TicketMaster.new(:rally, {:url => 'https://community.rallydev.com/slm',
+ :username => 'ticketmaster-rally@simeonfosterwillbanks.com',
+ :password => 'Password'})
+ end
+ @klass = TicketMaster::Provider::Rally::Project
+ end
+
+ before(:each) do
@project_name = "Sample Project"
@project_id = 2712835688
@project_created_at = "Tue Jan 18 15:40:28 UTC 2011"
end
- before(:each) do
- @ticketmaster = TicketMaster.new(:rally, {:url => 'https://community.rallydev.com/slm',
- :username => 'ticketmaster-rally@simeonfosterwillbanks.com',
- :password => 'Password'})
- @klass = TicketMaster::Provider::Rally::Project
- end
-
it "should be able to load all projects" do
- @ticketmaster.projects.should be_an_instance_of(Array)
- @ticketmaster.projects.first.should be_an_instance_of(@klass)
+ VCR.use_cassette('rally_projects') do
+ @ticketmaster.projects.should be_an_instance_of(Array)
+ @ticketmaster.projects.first.should be_an_instance_of(@klass)
+ end
end
it "should be able to find a project by id" do
- project = @ticketmaster.project(@project_id)
- project.should be_an_instance_of(@klass)
- project.name.should == @project_name
- project.id.should == @project_id
- project.created_at.utc.strftime('%a %b %d %H:%M:%S UTC %Y').should == @project_created_at
+ VCR.use_cassette('rally_by_id') { @project = @ticketmaster.project(@project_id) }
+ @project.should be_an_instance_of(@klass)
+ @project.name.should == @project_name
+ @project.id.should == @project_id
+ @project.created_at.utc.strftime('%a %b %d %H:%M:%S UTC %Y').should == @project_created_at
end
it "should be able to load all projects from an array of ids" do
- projects = @ticketmaster.projects([@project_id])
- projects.should be_an_instance_of(Array)
- projects.first.should be_an_instance_of(@klass)
- projects.first.name.should == @project_name
- projects.first.id.should == @project_id
- projects.first.created_at.utc.strftime('%a %b %d %H:%M:%S UTC %Y').should == @project_created_at
+ VCR.use_cassette('rally_projects_by_ids') { @projects = @ticketmaster.projects([@project_id]) }
+ @projects.should be_an_instance_of(Array)
+ @projects.first.should be_an_instance_of(@klass)
+ @projects.first.name.should == @project_name
+ @projects.first.id.should == @project_id
+ @projects.first.created_at.utc.strftime('%a %b %d %H:%M:%S UTC %Y').should == @project_created_at
end
it "should be able to load all projects from attributes" do
- projects = @ticketmaster.projects(:name => @project_name)
- projects.should be_an_instance_of(Array)
- projects.first.should be_an_instance_of(@klass)
- projects.first.name.should == @project_name
- projects.first.id.should == @project_id
- projects.first.created_at.utc.strftime('%a %b %d %H:%M:%S UTC %Y').should == @project_created_at
+ VCR.use_cassette('rally_projects_by_attributes') { @projects = @ticketmaster.projects(:name => @project_name)}
+ @projects.should be_an_instance_of(Array)
+ @projects.first.should be_an_instance_of(@klass)
+ @projects.first.name.should == @project_name
+ @projects.first.id.should == @project_id
+ @projects.first.created_at.utc.strftime('%a %b %d %H:%M:%S UTC %Y').should == @project_created_at
end
-
+
it "should be able to load projects using the find method" do
- @ticketmaster.project.should == @klass
- @ticketmaster.project.find(@project_id).should be_an_instance_of(@klass)
+ VCR.use_cassette('rally_project_return_class') do
+ @ticketmaster.project.should == @klass
+ @ticketmaster.project.find(@project_id).should be_an_instance_of(@klass)
+ end
end
end