spec/comments_spec.rb in ticketmaster-rally-0.1.2 vs spec/comments_spec.rb in ticketmaster-rally-0.2.2

- old
+ new

@@ -4,43 +4,48 @@ before(:all) do @project_id = 2712835688 @ticket_id = 2780205298 @comment_id = 2988719307 @comment_author = "sfw@simeonfosterwillbanks.com" + VCR.use_cassette('ticketmaster_setting') do + @ticketmaster = TicketMaster.new(:rally, {:url => 'https://community.rallydev.com/slm', + :username => 'ticketmaster-rally@simeonfosterwillbanks.com', + :password => 'Password'}) + + @project = @ticketmaster.project(@project_id) + @ticket = @project.ticket(:id => @ticket_id) + end end before(:each) do - @ticketmaster = TicketMaster.new(:rally, {:url => 'https://community.rallydev.com/slm', - :username => 'ticketmaster-rally@simeonfosterwillbanks.com', - :password => 'Password'}) - @project = @ticketmaster.project(@project_id) @klass = TicketMaster::Provider::Rally::Comment - @ticket = @project.ticket(:id => @ticket_id) end it "should be able to load all comments" do - @ticket.comments.should be_an_instance_of(Array) - @ticket.comments.first.should be_an_instance_of(@klass) + VCR.use_cassette('load_all_rally_comments') do + @ticket.comments.should be_an_instance_of(Array) + @ticket.comments.first.should be_an_instance_of(@klass) + end end - + it "should be able to load all comments based on array of ids" do - comments = @ticket.comments([@comment_id]) - comments.should be_an_instance_of(Array) - comments.first.should be_an_instance_of(@klass) - comments.first.author.should == @comment_author + VCR.use_cassette('load_comments_by_ids') { @comments = @ticket.comments([@comment_id]) } + @comments.should be_an_instance_of(Array) + @comments.first.should be_an_instance_of(@klass) + @comments.first.author.should == @comment_author end it "should be able to load all comments based on attributes" do - comments = @ticket.comments(:id => @comment_id) - comments.should be_an_instance_of(Array) - comments.first.should be_an_instance_of(@klass) - comments.first.author.should == @comment_author + VCR.use_cassette('load_comments_by_attributes') { @comments = @ticket.comments(:id => @comment_id) } + @comments.should be_an_instance_of(Array) + @comments.first.should be_an_instance_of(@klass) + @comments.first.author.should == @comment_author end - + it "should be able to create a new comment" do # Add discussion for User Story US8: Order picture package - ticket = @project.ticket(:id => 2712836091) - comment = ticket.comment!(:body => 'Pictures will be available for purchase!') - comment.should be_an_instance_of(@klass) + VCR.use_cassette('retrieve_ticket') {@ticket = @project.ticket(:id => 2712836091) } + VCR.use_cassette('create_comment') { @comment = @ticket.comment!(:body => 'Pictures will be available for purchase!') } + @comment.should be_an_instance_of(@klass) end - + end