Sha256: 430fe40d1a0c66ec2b6760ee7ef1851fa8cac3f984c5e5d0dfdc35bbba8c9056
Contents?: true
Size: 1.98 KB
Versions: 5
Compression:
Stored size: 1.98 KB
Contents
require 'spec_helper' describe Zendesk2::Client do let(:client) { create_client } context "with an organization" do let!(:organization) { client.organizations.create!(name: mock_uuid) } include_examples "zendesk#resource", { :collection => lambda { client.views }, :create_params => lambda { { :title => mock_uuid, :conditions => { "any" => [ {"field" => "organization_id", "operator" => "is", "value" => organization.identity.to_s } ], "all" => [ {"field" => "status", "operator" => "is", "value" => "pending" } ], } } }, :update_params => lambda { { title: mock_uuid } }, :search => false, } context "and a view that filters by that organization" do let!(:user) { client.users.create!(email: mock_email, name: mock_uuid, verified: true) } let!(:view) { client.views.create!( :title => mock_uuid, :conditions => { "all" => [ {"field" => "organization_id", "operator" => "is", "value" => organization.identity.to_s } ], } ) } before { client.memberships.create(user: user, organization: organization) } let!(:tickets) { 2.times.map { client.tickets.create!(subject: mock_uuid, description: mock_uuid, requester: user, organization: organization) } } before { another_organization = client.organizations.create!(name: mock_uuid) another_user = client.users.create!(email: mock_email, name: mock_uuid, verified: true) client.memberships.create(user: another_user, organization: another_organization) 2.times.each { client.tickets.create!(subject: mock_uuid, description: mock_uuid, requester: another_user) } } it "should find only that organizations tickets" do expect(view.tickets).to match_array(tickets) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
zendesk2-1.7.5 | spec/views_spec.rb |
zendesk2-1.7.4 | spec/views_spec.rb |
zendesk2-1.7.2 | spec/views_spec.rb |
zendesk2-1.7.1 | spec/views_spec.rb |
zendesk2-1.7.0 | spec/views_spec.rb |