spec/projects_spec.rb in ticketmaster-bugzilla-0.2.8 vs spec/projects_spec.rb in ticketmaster-bugzilla-0.2.9

- old
+ new

@@ -7,47 +7,34 @@ @projects = [@core] @klass = TicketMaster::Provider::Bugzilla::Project end before(:each) do - @ticketmaster = TicketMaster.new(:bugzilla, {:username => 'george.rafael@gmail.com', :password => '123456', :url =>'https://landfill.bugzilla.org/bugzilla-3.6-branch/'}) - Rubyzilla::Product.stub!(:list).and_return(@projects) + VCR.use_cassette('project-initialization') { @ticketmaster = TicketMaster.new(:bugzilla, {:username => 'george.rafael@gmail.com', :password => '123456', :url =>'https://landfill.bugzilla.org/bugzilla-3.6-branch/'}) } 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('load-all-projects') { @projects = @ticketmaster.projects } + @projects.should be_an_instance_of(Array) + @projects.first.should be_an_instance_of(@klass) end it "should be able to load projects using an array of id's" do - projects = @ticketmaster.projects([1,2,3]) - projects.should be_an_instance_of(Array) - projects.first.should be_an_instance_of(@klass) - projects.first.name.should == 'WorldControl' + VCR.use_cassette('projects-by-ids') { @projects = @ticketmaster.projects([1,2,3]) } + @projects.should be_an_instance_of(Array) + @projects.first.should be_an_instance_of(@klass) + @projects.first.name.should == 'WorldControl' end it "should be able to find a project by id" do - project = @ticketmaster.project(1) - project.should be_an_instance_of(@klass) - project.name.should == 'WorldControl' + VCR.use_cassette('projects-by-id') { @project = @ticketmaster.project(1) } + @project.should be_an_instance_of(@klass) + @project.name.should == 'WorldControl' end it "should be able to load project using the find method" do - project = @ticketmaster.project.find(1) - project.should be_an_instance_of(@klass) - project.name.should == 'WorldControl' - end - - it "should be able to find by attributes" do - project = @ticketmaster.project.find(:first, {:name => 'Core'}) - project.should be_an_instance_of(@klass) - project.name.should == 'Core' - end - - it "should be able to find by an array of id's" do - project = @ticketmaster.project.find(:all, [1,2]) - project.should be_an_instance_of(Array) - project.first.should be_an_instance_of(@klass) - project.first.name.should == 'Core' + VCR.use_cassette('project-by-find-method') { @project = @ticketmaster.project.find(1) } + @project.should be_an_instance_of(@klass) + @project.name.should == 'WorldControl' end end