peterosullivan-highrise 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/.gitignore +2 -0
  2. data/.travis.yml +9 -0
  3. data/Gemfile +3 -0
  4. data/Gemfile.lock +46 -0
  5. data/MIT-LICENSE +20 -0
  6. data/README.md +89 -0
  7. data/Rakefile +14 -0
  8. data/autotest/discover.rb +1 -0
  9. data/examples/config_initializers_highrise.rb +4 -0
  10. data/examples/extending.rb +31 -0
  11. data/examples/sample.rb +9 -0
  12. data/highrise.gemspec +33 -0
  13. data/lib/highrise/account.rb +7 -0
  14. data/lib/highrise/base.rb +25 -0
  15. data/lib/highrise/comment.rb +3 -0
  16. data/lib/highrise/company.rb +15 -0
  17. data/lib/highrise/deal.rb +8 -0
  18. data/lib/highrise/deal_category.rb +3 -0
  19. data/lib/highrise/email.rb +9 -0
  20. data/lib/highrise/group.rb +3 -0
  21. data/lib/highrise/kase.rb +19 -0
  22. data/lib/highrise/membership.rb +3 -0
  23. data/lib/highrise/note.rb +9 -0
  24. data/lib/highrise/pagination.rb +72 -0
  25. data/lib/highrise/party.rb +11 -0
  26. data/lib/highrise/person.rb +45 -0
  27. data/lib/highrise/recording.rb +5 -0
  28. data/lib/highrise/rfc822.rb +30 -0
  29. data/lib/highrise/searchable.rb +23 -0
  30. data/lib/highrise/subject.rb +31 -0
  31. data/lib/highrise/tag.rb +12 -0
  32. data/lib/highrise/taggable.rb +20 -0
  33. data/lib/highrise/task.rb +11 -0
  34. data/lib/highrise/task_category.rb +3 -0
  35. data/lib/highrise/user.rb +17 -0
  36. data/lib/highrise/version.rb +3 -0
  37. data/lib/highrise.rb +22 -0
  38. data/spec/highrise/account_spec.rb +10 -0
  39. data/spec/highrise/base_spec.rb +48 -0
  40. data/spec/highrise/comment_spec.rb +5 -0
  41. data/spec/highrise/company_spec.rb +17 -0
  42. data/spec/highrise/deal_category_spec.rb +13 -0
  43. data/spec/highrise/deal_spec.rb +23 -0
  44. data/spec/highrise/email_spec.rb +13 -0
  45. data/spec/highrise/group_spec.rb +5 -0
  46. data/spec/highrise/kase_spec.rb +17 -0
  47. data/spec/highrise/membership_spec.rb +5 -0
  48. data/spec/highrise/note_spec.rb +14 -0
  49. data/spec/highrise/pagination_behavior.rb +50 -0
  50. data/spec/highrise/pagination_spec.rb +8 -0
  51. data/spec/highrise/party_spec.rb +16 -0
  52. data/spec/highrise/person_spec.rb +33 -0
  53. data/spec/highrise/recording_spec.rb +7 -0
  54. data/spec/highrise/searchable_behavior.rb +13 -0
  55. data/spec/highrise/searchable_spec.rb +8 -0
  56. data/spec/highrise/subject_spec.rb +34 -0
  57. data/spec/highrise/tag_spec.rb +18 -0
  58. data/spec/highrise/taggable_behavior.rb +27 -0
  59. data/spec/highrise/taggable_spec.rb +9 -0
  60. data/spec/highrise/task_category_spec.rb +13 -0
  61. data/spec/highrise/task_spec.rb +11 -0
  62. data/spec/highrise/user_spec.rb +18 -0
  63. data/spec/spec_helper.rb +11 -0
  64. metadata +182 -0
@@ -0,0 +1,3 @@
1
+ module Highrise
2
+ class TaskCategory < Base; end
3
+ end
@@ -0,0 +1,17 @@
1
+ module Highrise
2
+ class User < Base
3
+ def join(group)
4
+ Membership.create(:user_id => id, :group_id => group.id)
5
+ end
6
+
7
+ # Permits API-key retrieval using name and password.
8
+ # Highrise::User.site = "https://yourcompany.highrise.com"
9
+ # Highrise::User.user = "your_user_name"
10
+ # Highrise::User.password = "s3kr3t"
11
+ # Highrise::User.me.token # contains the API token for "your_user_name"
12
+ def self.me
13
+ user = User.new()
14
+ find(:one, :from => "/me.xml")
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ module Highrise
2
+ VERSION = "3.0.2"
3
+ end
data/lib/highrise.rb ADDED
@@ -0,0 +1,22 @@
1
+ require 'highrise/base'
2
+ require 'highrise/pagination'
3
+ require 'highrise/taggable'
4
+ require 'highrise/searchable'
5
+ require 'highrise/subject'
6
+ require 'highrise/comment'
7
+ require 'highrise/company'
8
+ require 'highrise/email'
9
+ require 'highrise/group'
10
+ require 'highrise/kase'
11
+ require 'highrise/membership'
12
+ require 'highrise/note'
13
+ require 'highrise/person'
14
+ require 'highrise/task'
15
+ require 'highrise/user'
16
+ require 'highrise/tag'
17
+ require 'highrise/deal'
18
+ require 'highrise/account'
19
+ require 'highrise/deal_category'
20
+ require 'highrise/task_category'
21
+ require 'highrise/party'
22
+ require 'highrise/recording'
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe Highrise::Account do
4
+ it { should be_a_kind_of Highrise::Base }
5
+
6
+ it ".me" do
7
+ Highrise::Account.should_receive(:find).with(:one, {:from => "/account.xml"}).and_return(subject)
8
+ Highrise::Account.me.should == subject
9
+ end
10
+ end
@@ -0,0 +1,48 @@
1
+ require 'spec_helper'
2
+
3
+ describe Highrise::Base do
4
+ it { subject.should be_a_kind_of ActiveResource::Base }
5
+
6
+ describe "dynamic finder methods" do
7
+ context "without pagination" do
8
+ before do
9
+ @deal_one = Highrise::Base.new(:id => 1, :name => "A deal")
10
+ @deal_two = Highrise::Base.new(:id => 2, :name => "A deal")
11
+ @deal_three = Highrise::Base.new(:id => 3, :name => "Another deal")
12
+ Highrise::Base.should_receive(:find).with(:all).and_return([@deal_one, @deal_two, @deal_three])
13
+ end
14
+ it ".find_by_(attribute) finds one" do
15
+ Highrise::Base.find_by_name("A deal").should == @deal_one
16
+ end
17
+
18
+ it ".find_all_by_(attribute) finds all" do
19
+ Highrise::Base.find_all_by_name("A deal").should == [@deal_one, @deal_two]
20
+ end
21
+ end
22
+
23
+ context "with pagination" do
24
+ before do
25
+ class PaginatedBaseClass < Highrise::Base; include Highrise::Pagination; end
26
+ @john_doe = PaginatedBaseClass.new(:id => 1, :first_name => "John")
27
+ @john_baker = PaginatedBaseClass.new(:id => 2, :first_name => "John")
28
+ @joe_smith = PaginatedBaseClass.new(:id => 3, :first_name => "Joe")
29
+ PaginatedBaseClass.should_receive(:find_all_across_pages).and_return([@john_doe, @john_baker, @joe_smith])
30
+ end
31
+ it ".find_by_(attribute) finds one" do
32
+ PaginatedBaseClass.find_by_first_name("John").should == @john_doe
33
+ end
34
+
35
+ it ".find_all_by_(attribute) finds all" do
36
+ PaginatedBaseClass.find_all_by_first_name("John").should == [@john_doe, @john_baker]
37
+ end
38
+ end
39
+
40
+ it "expects arguments to the finder" do
41
+ expect { Highrise::Base.find_all_by_first_name }.to raise_error(ArgumentError)
42
+ end
43
+
44
+ it "falls back to regular method missing" do
45
+ expect { Highrise::Base.any_other_method }.to raise_error(NoMethodError)
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe Highrise::Comment do
4
+ it { should be_a_kind_of Highrise::Base }
5
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe Highrise::Company do
4
+ subject { Highrise::Company.new(:id => 1) }
5
+
6
+ it { should be_a_kind_of Highrise::Base }
7
+ it_should_behave_like "a paginated class"
8
+ it_should_behave_like "a taggable class"
9
+ it_should_behave_like "a searchable class"
10
+
11
+ it "#people" do
12
+ Highrise::Person.should_receive(:find_all_across_pages).with(:from=>"/companies/1/people.xml").and_return("people")
13
+ subject.people.should == "people"
14
+ end
15
+
16
+ it { subject.label.should == 'Party' }
17
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe Highrise::DealCategory do
4
+ subject { Highrise::DealCategory.new(:id => 1, :name => "Deal Category") }
5
+
6
+ it { should be_a_kind_of Highrise::Base }
7
+
8
+ it ".find_by_name" do
9
+ deal_category = Highrise::DealCategory.new(:id => 2, :name => "Another Deal Category")
10
+ Highrise::DealCategory.should_receive(:find).with(:all).and_return([deal_category, subject])
11
+ Highrise::DealCategory.find_by_name("Deal Category").should == subject
12
+ end
13
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe Highrise::Deal do
4
+ subject { Highrise::Deal.new(:id => 1) }
5
+
6
+ it { should be_a_kind_of Highrise::Subject }
7
+
8
+ it ".add_note" do
9
+ Highrise::Note.should_receive(:create).with({:body=>"body", :subject_id=>1, :subject_type=>'Deal'}).and_return(mock('note'))
10
+ subject.add_note :body=>'body'
11
+ end
12
+
13
+ describe ".update_status" do
14
+ it { expect { subject.update_status("invalid") }.to raise_error(ArgumentError) }
15
+
16
+ %w[pending won lost].each do |status|
17
+ it "updates status to #{status}" do
18
+ subject.should_receive(:put).with(:status, :status => {:name => status})
19
+ subject.update_status(status)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe Highrise::Email do
4
+ it { should be_a_kind_of Highrise::Base }
5
+
6
+ it_should_behave_like "a paginated class"
7
+
8
+ it "#comments" do
9
+ subject.should_receive(:email_id).and_return(1)
10
+ Highrise::Comment.should_receive(:find).with(:all, {:from=>"/emails/1/comments.xml"}).and_return("comments")
11
+ subject.comments.should == "comments"
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe Highrise::Group do
4
+ it { should be_a_kind_of Highrise::Base }
5
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe Highrise::Kase do
4
+ it { should be_a_kind_of Highrise::Subject }
5
+
6
+ it "#close!" do
7
+ mocked_now = Time.parse("Wed Jan 14 15:43:11 -0200 2009")
8
+ Time.should_receive(:now).and_return(mocked_now)
9
+ subject.should_receive(:update_attribute).with(:closed_at, mocked_now.utc)
10
+ subject.close!
11
+ end
12
+
13
+ it "#open!" do
14
+ subject.should_receive(:update_attribute).with(:closed_at, nil)
15
+ subject.open!
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe Highrise::Membership do
4
+ it { should be_a_kind_of Highrise::Base }
5
+ end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe Highrise::Note do
4
+ subject { Highrise::Note.new(:id => 1) }
5
+
6
+ it { should be_a_kind_of Highrise::Base }
7
+
8
+ it_should_behave_like "a paginated class"
9
+
10
+ it "#comments" do
11
+ Highrise::Comment.should_receive(:find).with(:all, {:from=>"/notes/1/comments.xml"}).and_return("comments")
12
+ subject.comments.should == "comments"
13
+ end
14
+ end
@@ -0,0 +1,50 @@
1
+ shared_examples_for "a paginated class" do
2
+ it { subject.class.included_modules.should include(Highrise::Pagination) }
3
+
4
+ it ".find_all_across_pages" do
5
+ subject.class.should_receive(:find).with(:all,{:params=>{:n=>0}}).and_return(["things"])
6
+ subject.class.should_receive(:find).with(:all,{:params=>{:n=>1}}).and_return([])
7
+ subject.class.find_all_across_pages.should == ["things"]
8
+ end
9
+
10
+ it ".find_all_across_pages with zero results" do
11
+ subject.class.should_receive(:find).with(:all,{:params=>{:n=>0}}).and_return(nil)
12
+ subject.class.find_all_across_pages.should == []
13
+ end
14
+
15
+ it ".find_all_across_pages_since" do
16
+ time = Time.parse("Wed Jan 14 15:43:11 -0200 2009")
17
+ subject.class.should_receive(:find_all_across_pages).with({:params=>{:since=>"20090114174311"}}).and_return("result")
18
+ subject.class.find_all_across_pages_since(time).should == "result"
19
+ end
20
+
21
+ it ".find_all_deletions_across_pages" do
22
+ class TestClass2 < Highrise::Base; include Highrise::Pagination; end
23
+ subject_type = subject.class.to_s.split('::').last
24
+ deleted_resource_1 = subject.class.new(:id => 12, :type => subject_type)
25
+ deleted_resource_2 = TestClass2.new(:id => 34, :type => 'TestClass2')
26
+ deleted_resource_3 = subject.class.new(:id => 45, :type => subject_type)
27
+
28
+ subject.class.should_receive(:find).with(:all,{:from => '/deletions.xml', :params=>{:n=>1}}).and_return([deleted_resource_1, deleted_resource_2, deleted_resource_3])
29
+ subject.class.should_receive(:find).with(:all,{:from => '/deletions.xml', :params=>{:n=>2}}).and_return([])
30
+ subject.class.find_all_deletions_across_pages.should == [deleted_resource_1, deleted_resource_3]
31
+ end
32
+
33
+ it ".find_all_deletions_across_pages with zero results" do
34
+ subject.class.should_receive(:find).with(:all,{:from => '/deletions.xml', :params=>{:n=>1}}).and_return(nil)
35
+ subject.class.find_all_deletions_across_pages.should == []
36
+ end
37
+
38
+ it ".find_all_deletions_across_pages_since" do
39
+ class TestClass2 < Highrise::Base; include Highrise::Pagination; end
40
+ subject_type = subject.class.to_s.split('::').last
41
+ time = Time.parse("Wed Jan 14 15:43:11 -0200 2009")
42
+ deleted_resource_1 = subject.class.new(:id => 12, :type => subject_type)
43
+ deleted_resource_2 = TestClass2.new(:id => 34, :type => 'TestClass2')
44
+ deleted_resource_3 = subject.class.new(:id => 45, :type => subject_type)
45
+
46
+ subject.class.should_receive(:find).with(:all,{:from => '/deletions.xml', :params=>{:n=>1, :since=>"20090114174311"}}).and_return([deleted_resource_1, deleted_resource_2, deleted_resource_3])
47
+ subject.class.should_receive(:find).with(:all,{:from => '/deletions.xml', :params=>{:n=>2, :since=>"20090114174311"}}).and_return([])
48
+ subject.class.find_all_deletions_across_pages_since(time).should == [deleted_resource_1, deleted_resource_3]
49
+ end
50
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe Highrise::Pagination do
4
+ class TestClass < Highrise::Base; include Highrise::Pagination; end
5
+ subject { TestClass.new }
6
+
7
+ it_should_behave_like "a paginated class"
8
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe Highrise::Party do
4
+ it { should be_a_kind_of Highrise::Base }
5
+
6
+ it ".recently_viewed" do
7
+ Highrise::Party.should_receive(:find).with(:all, {:from => '/parties/recently_viewed.xml'})
8
+ Highrise::Party.recently_viewed
9
+ end
10
+
11
+ it ".deletions_since" do
12
+ time = Time.parse("Wed Jan 14 15:43:11 -0200 2009")
13
+ Highrise::Party.should_receive(:find).with(:all, {:from => '/parties/deletions.xml', :params=>{:since=>"20090114174311"}}).and_return("result")
14
+ Highrise::Party.deletions_since(time).should == "result"
15
+ end
16
+ end
@@ -0,0 +1,33 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe Highrise::Person do
5
+ subject { Highrise::Person.new(:id => 1) }
6
+
7
+ it { should be_a_kind_of Highrise::Subject }
8
+
9
+ it_should_behave_like "a paginated class"
10
+ it_should_behave_like "a taggable class"
11
+ it_should_behave_like "a searchable class"
12
+
13
+ describe "#company" do
14
+ it "returns nil when it doesn't have a company" do
15
+ subject.should_receive(:company_id).and_return(nil)
16
+ subject.company.should be_nil
17
+ end
18
+
19
+ it "delegate to Highrise::Company when have company_id" do
20
+ subject.should_receive(:company_id).at_least(2).times.and_return(1)
21
+ Highrise::Company.should_receive(:find).with(1).and_return("company")
22
+ subject.company.should == "company"
23
+ end
24
+ end
25
+
26
+ it "#name" do
27
+ subject.should_receive(:first_name).and_return("Marcos")
28
+ subject.should_receive(:last_name).and_return("Tapajós ")
29
+ subject.name.should == "Marcos Tapajós"
30
+ end
31
+
32
+ it { subject.label.should == 'Party' }
33
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe Highrise::Recording do
4
+ it { should be_a_kind_of Highrise::Base }
5
+
6
+ it_should_behave_like "a paginated class"
7
+ end
@@ -0,0 +1,13 @@
1
+ shared_examples_for "a searchable class" do
2
+ it { subject.class.included_modules.should include(Highrise::Searchable) }
3
+
4
+ it ".search" do
5
+ find_args = {:from => "/#{subject.class.collection_name}/search.xml", :params => {"criteria[email]" => "john.doe@example.com", "criteria[zip]" => "90210"}}
6
+ if subject.class.respond_to?(:find_all_across_pages)
7
+ subject.class.should_receive(:find_all_across_pages).with(find_args)
8
+ else
9
+ subject.class.should_receive(:find).with(:all, find_args)
10
+ end
11
+ subject.class.search(:email => "john.doe@example.com", :zip => "90210")
12
+ end
13
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe Highrise::Searchable do
4
+ class TestClass < Highrise::Base; include Highrise::Searchable; end
5
+ subject { TestClass.new }
6
+
7
+ it_should_behave_like "a searchable class"
8
+ end
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+ describe Highrise::Subject do
4
+ subject { Highrise::Subject.new(:id => 1) }
5
+
6
+ it { should be_a_kind_of Highrise::Base }
7
+
8
+ it "#notes" do
9
+ Highrise::Note.should_receive(:find_all_across_pages).with({:from=>"/subjects/1/notes.xml"}).and_return("notes")
10
+ subject.notes.should == "notes"
11
+ end
12
+
13
+ it "#add_note" do
14
+ Highrise::Note.should_receive(:create).with({:body=>"body", :subject_id=>1, :subject_type=>'Subject'}).and_return(mock('note'))
15
+ subject.add_note :body=>'body'
16
+ end
17
+
18
+ it "#add_task" do
19
+ Highrise::Task.should_receive(:create).with({:body=>"body", :subject_id=>1, :subject_type=>'Subject'}).and_return(mock('task'))
20
+ subject.add_task :body=>'body'
21
+ end
22
+
23
+ it "#emails" do
24
+ Highrise::Email.should_receive(:find_all_across_pages).with({:from=>"/subjects/1/emails.xml"}).and_return("emails")
25
+ subject.emails.should == "emails"
26
+ end
27
+
28
+ it "#upcoming_tasks" do
29
+ Highrise::Task.should_receive(:find).with(:all, {:from=>"/subjects/1/tasks.xml"}).and_return("tasks")
30
+ subject.upcoming_tasks.should == "tasks"
31
+ end
32
+
33
+ it { subject.label.should == "Subject" }
34
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe Highrise::Tag do
4
+ subject { Highrise::Tag.new(:id => 1, :name => "Name") }
5
+
6
+ it { should be_a_kind_of Highrise::Base }
7
+
8
+ it "supports equality" do
9
+ tag = Highrise::Tag.new(:id => 1, :name => "Name")
10
+ subject.should == tag
11
+ end
12
+
13
+ it ".find_by_name" do
14
+ tag = Highrise::Tag.new(:id => 2, :name => "Next")
15
+ Highrise::Tag.should_receive(:find).with(:all).and_return([tag, subject])
16
+ Highrise::Tag.find_by_name("Name").should == subject
17
+ end
18
+ end
@@ -0,0 +1,27 @@
1
+ shared_examples_for "a taggable class" do
2
+ before(:each) do
3
+ (@tags = []).tap do
4
+ @tags << {'id' => "414578", 'name' => "cliente"}
5
+ @tags << {'id' => "414580", 'name' => "ged"}
6
+ @tags << {'id' => "414579", 'name' => "iepc"}
7
+ end
8
+ end
9
+
10
+ it { subject.class.included_modules.should include(Highrise::Taggable) }
11
+
12
+ it "#tags" do
13
+ subject.should_receive(:get).with(:tags).and_return(@tags)
14
+ subject.tags.should == @tags
15
+ end
16
+
17
+ it "#tag!(tag_name)" do
18
+ subject.should_receive(:post).with(:tags, :name => "client" ).and_return(true)
19
+ subject.tag!("client").should be_true
20
+ end
21
+
22
+ it "#untag!(tag_name)" do
23
+ subject.should_receive(:get).with(:tags).and_return(@tags)
24
+ subject.should_receive(:delete).with("tags/414578").and_return(true)
25
+ subject.untag!("cliente").should be_true
26
+ end
27
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe Highrise::Taggable do
4
+ class TestClass < Highrise::Base; include Highrise::Taggable; end
5
+
6
+ subject { TestClass.new }
7
+
8
+ it_should_behave_like "a taggable class"
9
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe Highrise::TaskCategory do
4
+ subject { Highrise::TaskCategory.new(:id => 1, :name => "Task Category") }
5
+
6
+ it { should be_a_kind_of Highrise::Base }
7
+
8
+ it ".find_by_name" do
9
+ task_category = Highrise::TaskCategory.new(:id => 2, :name => "Another Task Category")
10
+ Highrise::TaskCategory.should_receive(:find).with(:all).and_return([task_category, subject])
11
+ Highrise::TaskCategory.find_by_name("Task Category").should == subject
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe Highrise::Task do
4
+ it { should be_a_kind_of Highrise::Base }
5
+
6
+ it "#complete!" do
7
+ subject.should_receive(:load_attributes_from_response).with("post")
8
+ subject.should_receive(:post).with(:complete).and_return("post")
9
+ subject.complete!
10
+ end
11
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe Highrise::User do
4
+ it { should be_a_kind_of Highrise::Base }
5
+
6
+ it ".me" do
7
+ Highrise::User.should_receive(:find).with(:one, {:from => "/me.xml"}).and_return(subject)
8
+ Highrise::User.me.should == subject
9
+ end
10
+
11
+ it "#join" do
12
+ group_mock = mock("group")
13
+ group_mock.should_receive(:id).and_return(2)
14
+ subject.should_receive(:id).and_return(1)
15
+ Highrise::Membership.should_receive(:create).with({:user_id=>1, :group_id=>2})
16
+ subject.join(group_mock)
17
+ end
18
+ end
@@ -0,0 +1,11 @@
1
+ require 'bundler'
2
+ Bundler.setup
3
+
4
+ require File.join(File.dirname(__FILE__), '/../lib/highrise')
5
+
6
+ Highrise::Base.user = ENV['HIGHRISE_USER'] || 'x'
7
+ Highrise::Base.site = ENV['HIGHRISE_SITE'] || 'https://www.example.com'
8
+
9
+ require 'highrise/pagination_behavior'
10
+ require 'highrise/searchable_behavior'
11
+ require 'highrise/taggable_behavior'