Sha256: a1b9e9c18b209a701ef433449e495968b0f0aaa2b2e170217712affafab6b289

Contents?: true

Size: 1.77 KB

Versions: 5

Compression:

Stored size: 1.77 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "Ticketmaster::Provider::Bugzilla::Project" do

  before(:all) do 
    @core = {:id => 1, :name => 'Core'}
    @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)
  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)
  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'
  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'
  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'
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ticketmaster-bugzilla-0.0.5 spec/projects_spec.rb
ticketmaster-bugzilla-0.0.4 spec/projects_spec.rb
ticketmaster-bugzilla-0.0.3 spec/projects_spec.rb
ticketmaster-bugzilla-0.0.2 spec/projects_spec.rb
ticketmaster-bugzilla-0.0.1 spec/projects_spec.rb