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

- old
+ new

@@ -3,50 +3,42 @@ describe "Ticketmaster::Provider::Bugzilla::Ticket" do before(:all) do @klass = TicketMaster::Provider::Bugzilla::Ticket bug = {:id => 7039} - Rubyzilla::Product.stub!(:bugs).and_return([bug]) - Rubyzilla::Bug.stub!(:create).and_return(bug) end before(:each) do - @ticketmaster = TicketMaster.new(:bugzilla, {:username => 'george.rafael@gmail.com', :password => '123456', :url =>'https://landfill.bugzilla.org/bugzilla-3.6-branch'}) - @project = @ticketmaster.project(1) + VCR.use_cassette('ticketmaster-instance') { @ticketmaster = TicketMaster.new(:bugzilla, :username => 'george.rafael@gmail.com', :password => '123456', :url =>'https://landfill.bugzilla.org/bugzilla-3.6-branch') } + VCR.use_cassette('loading-a-project') { @project = @ticketmaster.project(20) } end it "should be able to load all tickets" do - tickets = @project.tickets - tickets.should be_an_instance_of(Array) - tickets.first.should be_an_instance_of(@klass) + VCR.use_cassette('load-all-tickets') { @tickets = @project.tickets } + @tickets.should be_an_instance_of(Array) + @tickets.first.should be_an_instance_of(@klass) end it "should be able to load all tickets from an array of id's" do - tickets = @project.tickets([7039]) - tickets.should be_an_instance_of(Array) - tickets.first.should be_an_instance_of(@klass) - tickets.first.id.should == 1 + VCR.use_cassette('load-tickets-by-ids') { @tickets = @project.tickets([7039]) } + @tickets.should be_an_instance_of(Array) + @tickets.first.should be_an_instance_of(@klass) + @tickets.first.id.should == 7039 end it "should be able to search tickets based on id attribute" do - tickets = @project.tickets(:id => 7039) - tickets.should be_an_instance_of(Array) - tickets.first.should be_an_instance_of(@klass) + VCR.use_cassette('load-by-attributes') { @tickets = @project.tickets(:project_id => 20) } + @tickets.should be_an_instance_of(Array) + @tickets.first.should be_an_instance_of(@klass) end it "should be able to search a ticket by id" do - ticket = @project.ticket(7039) - ticket.should be_an_instance_of(@klass) - ticket.id.should == 7039 + VCR.use_cassette('load-by-id') { @ticket = @project.ticket(7039) } + @ticket.should be_an_instance_of(@klass) + @ticket.id.should == 7039 end - it "should be able to return a ticket by attributes" do - ticket = @project.ticket(:id => 7039) - ticket.should be_an_instance_of(@klass) - ticket.id.should == 7039 - end - it "should be able to create a ticket" do - ticket = @project.ticket!(:summary => "The program crashes", :description => "It crashes", :component => "EconomicControl", :op_sys => "Linux", :platform => "x86") - ticket.should be_an_instance_of(@klass) + VCR.use_cassette('create-a-ticket') { @ticket = @project.ticket!(:summary => "The program crashes", :description => "It crashes", :component => "EconomicControl", :op_sys => "Linux", :platform => "x86") } + @ticket.should be_an_instance_of(@klass) end end