simple_crowd 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/simple_crowd/mock_client.rb +15 -2
- data/lib/simple_crowd/version.rb +1 -1
- metadata +4 -4
| @@ -2,15 +2,16 @@ | |
| 2 2 | 
             
            module SimpleCrowd
         | 
| 3 3 | 
             
              class MockClient
         | 
| 4 4 | 
             
                class << self
         | 
| 5 | 
            -
                  attr_accessor :users, :tokens
         | 
| 5 | 
            +
                  attr_accessor :users, :tokens, :groups
         | 
| 6 6 |  | 
| 7 7 | 
             
                  def reset
         | 
| 8 | 
            -
                    @users, @tokens = [], []
         | 
| 8 | 
            +
                    @users, @tokens, @groups = [], [], []
         | 
| 9 9 | 
             
                  end
         | 
| 10 10 | 
             
                end
         | 
| 11 11 |  | 
| 12 12 | 
             
                @users = []
         | 
| 13 13 | 
             
                @tokens = []
         | 
| 14 | 
            +
                @groups = []
         | 
| 14 15 |  | 
| 15 16 | 
             
                def get_cookie_info
         | 
| 16 17 | 
             
                  {:secure=>false, :domain=>".twcrowdtest.com"}
         | 
| @@ -87,6 +88,17 @@ module SimpleCrowd | |
| 87 88 | 
             
                  end
         | 
| 88 89 | 
             
                end
         | 
| 89 90 |  | 
| 91 | 
            +
                def is_group_member? group, user
         | 
| 92 | 
            +
                  group = find_group_by_name(group) unless group.is_a?(SimpleCrowd::Group)
         | 
| 93 | 
            +
                  !!(group && group.members.detect{|m| m == user})
         | 
| 94 | 
            +
                end
         | 
| 95 | 
            +
                def find_group_by_name name
         | 
| 96 | 
            +
                  groups.detect{|g| g.name == name}
         | 
| 97 | 
            +
                end
         | 
| 98 | 
            +
                def find_all_group_names
         | 
| 99 | 
            +
                  groups.map{|g| g.name}
         | 
| 100 | 
            +
                end
         | 
| 101 | 
            +
             | 
| 90 102 | 
             
                private
         | 
| 91 103 | 
             
                def new_user_token username
         | 
| 92 104 | 
             
                  random_token(username).tap{|t| tokens << t}
         | 
| @@ -97,6 +109,7 @@ module SimpleCrowd | |
| 97 109 |  | 
| 98 110 | 
             
                def tokens; self.class.tokens; end
         | 
| 99 111 | 
             
                def users; self.class.users; end
         | 
| 112 | 
            +
                def groups; self.class.groups; end
         | 
| 100 113 |  | 
| 101 114 | 
             
              end
         | 
| 102 115 | 
             
            end
         | 
    
        data/lib/simple_crowd/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,13 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: simple_crowd
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              hash:  | 
| 4 | 
            +
              hash: 21
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 7 | 
             
              - 1
         | 
| 8 8 | 
             
              - 0
         | 
| 9 | 
            -
              -  | 
| 10 | 
            -
              version: 1.0. | 
| 9 | 
            +
              - 1
         | 
| 10 | 
            +
              version: 1.0.1
         | 
| 11 11 | 
             
            platform: ruby
         | 
| 12 12 | 
             
            authors: 
         | 
| 13 13 | 
             
            - Paul Strong
         | 
| @@ -15,7 +15,7 @@ autorequire: | |
| 15 15 | 
             
            bindir: bin
         | 
| 16 16 | 
             
            cert_chain: []
         | 
| 17 17 |  | 
| 18 | 
            -
            date: 2011- | 
| 18 | 
            +
            date: 2011-07-06 00:00:00 -05:00
         | 
| 19 19 | 
             
            default_executable: 
         | 
| 20 20 | 
             
            dependencies: 
         | 
| 21 21 | 
             
            - !ruby/object:Gem::Dependency 
         |