chef_fixie 0.1.0 → 0.5.0
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.
- checksums.yaml +5 -5
- data/bin/chef_fixie +2 -2
- data/doc/AccessingSQL.md +33 -1
- data/doc/BulkFixup.md +33 -0
- data/doc/CommonTasks.md +14 -3
- data/lib/chef_fixie.rb +7 -6
- data/lib/chef_fixie/authz_mapper.rb +26 -28
- data/lib/chef_fixie/authz_objects.rb +51 -41
- data/lib/chef_fixie/bulk_edit_permissions.rb +161 -0
- data/lib/chef_fixie/check_org_associations.rb +56 -59
- data/lib/chef_fixie/config.rb +58 -23
- data/lib/chef_fixie/console.rb +17 -12
- data/lib/chef_fixie/context.rb +2 -4
- data/lib/chef_fixie/sql.rb +12 -12
- data/lib/chef_fixie/sql_objects.rb +107 -31
- data/lib/chef_fixie/utility_helpers.rb +13 -9
- data/lib/chef_fixie/version.rb +1 -1
- data/spec/chef_fixie/acl_spec.rb +23 -25
- data/spec/chef_fixie/assoc_invite_spec.rb +5 -8
- data/spec/chef_fixie/check_org_associations_spec.rb +14 -17
- data/spec/chef_fixie/groups_spec.rb +7 -11
- data/spec/chef_fixie/org_spec.rb +4 -5
- data/spec/chef_fixie/orgs_spec.rb +6 -9
- data/spec/spec_helper.rb +5 -6
- metadata +13 -49
- data/bin/bundler +0 -16
- data/bin/chef-apply +0 -16
- data/bin/chef-client +0 -16
- data/bin/chef-shell +0 -16
- data/bin/chef-solo +0 -16
- data/bin/chef-zero +0 -16
- data/bin/coderay +0 -16
- data/bin/edit_json.rb +0 -16
- data/bin/erubis +0 -16
- data/bin/ffi-yajl-bench +0 -16
- data/bin/fixie~ +0 -231
- data/bin/htmldiff +0 -16
- data/bin/knife +0 -16
- data/bin/ldiff +0 -16
- data/bin/net-dhcp +0 -16
- data/bin/ohai +0 -16
- data/bin/prettify_json.rb +0 -16
- data/bin/pry +0 -16
- data/bin/rackup +0 -16
- data/bin/rake +0 -16
- data/bin/rdoc +0 -16
- data/bin/restclient +0 -16
- data/bin/ri +0 -16
- data/bin/rspec +0 -16
- data/bin/s3sh +0 -16
- data/bin/sequel +0 -16
- data/bin/serverspec-init +0 -16
- data/doc/AccessingSQL.md~ +0 -32
- data/doc/BulkFixup.md~ +0 -28
- data/doc/CommonTasks.md~ +0 -0
- data/doc/GETTING_STARTED.md~ +0 -6
- data/spec/chef_fixie/assoc_invite_spec.rb~ +0 -26
- data/spec/chef_fixie/check_org_associations_spec.rb~ +0 -34
- data/spec/chef_fixie/org_spec.rb~ +0 -53
    
        data/bin/ldiff
    DELETED
    
    | @@ -1,16 +0,0 @@ | |
| 1 | 
            -
            #!/usr/bin/env ruby
         | 
| 2 | 
            -
            #
         | 
| 3 | 
            -
            # This file was generated by Bundler.
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # The application 'ldiff' is installed as part of a gem, and
         | 
| 6 | 
            -
            # this file is here to facilitate running it.
         | 
| 7 | 
            -
            #
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            require 'pathname'
         | 
| 10 | 
            -
            ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
         | 
| 11 | 
            -
              Pathname.new(__FILE__).realpath)
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            require 'rubygems'
         | 
| 14 | 
            -
            require 'bundler/setup'
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            load Gem.bin_path('diff-lcs', 'ldiff')
         | 
    
        data/bin/net-dhcp
    DELETED
    
    | @@ -1,16 +0,0 @@ | |
| 1 | 
            -
            #!/usr/bin/env ruby
         | 
| 2 | 
            -
            #
         | 
| 3 | 
            -
            # This file was generated by Bundler.
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # The application 'net-dhcp' is installed as part of a gem, and
         | 
| 6 | 
            -
            # this file is here to facilitate running it.
         | 
| 7 | 
            -
            #
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            require 'pathname'
         | 
| 10 | 
            -
            ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
         | 
| 11 | 
            -
              Pathname.new(__FILE__).realpath)
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            require 'rubygems'
         | 
| 14 | 
            -
            require 'bundler/setup'
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            load Gem.bin_path('net-dhcp', 'net-dhcp')
         | 
    
        data/bin/ohai
    DELETED
    
    | @@ -1,16 +0,0 @@ | |
| 1 | 
            -
            #!/usr/bin/env ruby
         | 
| 2 | 
            -
            #
         | 
| 3 | 
            -
            # This file was generated by Bundler.
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # The application 'ohai' is installed as part of a gem, and
         | 
| 6 | 
            -
            # this file is here to facilitate running it.
         | 
| 7 | 
            -
            #
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            require 'pathname'
         | 
| 10 | 
            -
            ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
         | 
| 11 | 
            -
              Pathname.new(__FILE__).realpath)
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            require 'rubygems'
         | 
| 14 | 
            -
            require 'bundler/setup'
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            load Gem.bin_path('ohai', 'ohai')
         | 
    
        data/bin/prettify_json.rb
    DELETED
    
    | @@ -1,16 +0,0 @@ | |
| 1 | 
            -
            #!/usr/bin/env ruby
         | 
| 2 | 
            -
            #
         | 
| 3 | 
            -
            # This file was generated by Bundler.
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # The application 'prettify_json.rb' is installed as part of a gem, and
         | 
| 6 | 
            -
            # this file is here to facilitate running it.
         | 
| 7 | 
            -
            #
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            require 'pathname'
         | 
| 10 | 
            -
            ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
         | 
| 11 | 
            -
              Pathname.new(__FILE__).realpath)
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            require 'rubygems'
         | 
| 14 | 
            -
            require 'bundler/setup'
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            load Gem.bin_path('json', 'prettify_json.rb')
         | 
    
        data/bin/pry
    DELETED
    
    | @@ -1,16 +0,0 @@ | |
| 1 | 
            -
            #!/usr/bin/env ruby
         | 
| 2 | 
            -
            #
         | 
| 3 | 
            -
            # This file was generated by Bundler.
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # The application 'pry' is installed as part of a gem, and
         | 
| 6 | 
            -
            # this file is here to facilitate running it.
         | 
| 7 | 
            -
            #
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            require 'pathname'
         | 
| 10 | 
            -
            ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
         | 
| 11 | 
            -
              Pathname.new(__FILE__).realpath)
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            require 'rubygems'
         | 
| 14 | 
            -
            require 'bundler/setup'
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            load Gem.bin_path('pry', 'pry')
         | 
    
        data/bin/rackup
    DELETED
    
    | @@ -1,16 +0,0 @@ | |
| 1 | 
            -
            #!/usr/bin/env ruby
         | 
| 2 | 
            -
            #
         | 
| 3 | 
            -
            # This file was generated by Bundler.
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # The application 'rackup' is installed as part of a gem, and
         | 
| 6 | 
            -
            # this file is here to facilitate running it.
         | 
| 7 | 
            -
            #
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            require 'pathname'
         | 
| 10 | 
            -
            ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
         | 
| 11 | 
            -
              Pathname.new(__FILE__).realpath)
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            require 'rubygems'
         | 
| 14 | 
            -
            require 'bundler/setup'
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            load Gem.bin_path('rack', 'rackup')
         | 
    
        data/bin/rake
    DELETED
    
    | @@ -1,16 +0,0 @@ | |
| 1 | 
            -
            #!/usr/bin/env ruby
         | 
| 2 | 
            -
            #
         | 
| 3 | 
            -
            # This file was generated by Bundler.
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # The application 'rake' is installed as part of a gem, and
         | 
| 6 | 
            -
            # this file is here to facilitate running it.
         | 
| 7 | 
            -
            #
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            require 'pathname'
         | 
| 10 | 
            -
            ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
         | 
| 11 | 
            -
              Pathname.new(__FILE__).realpath)
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            require 'rubygems'
         | 
| 14 | 
            -
            require 'bundler/setup'
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            load Gem.bin_path('rake', 'rake')
         | 
    
        data/bin/rdoc
    DELETED
    
    | @@ -1,16 +0,0 @@ | |
| 1 | 
            -
            #!/usr/bin/env ruby
         | 
| 2 | 
            -
            #
         | 
| 3 | 
            -
            # This file was generated by Bundler.
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # The application 'rdoc' is installed as part of a gem, and
         | 
| 6 | 
            -
            # this file is here to facilitate running it.
         | 
| 7 | 
            -
            #
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            require 'pathname'
         | 
| 10 | 
            -
            ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
         | 
| 11 | 
            -
              Pathname.new(__FILE__).realpath)
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            require 'rubygems'
         | 
| 14 | 
            -
            require 'bundler/setup'
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            load Gem.bin_path('rdoc', 'rdoc')
         | 
    
        data/bin/restclient
    DELETED
    
    | @@ -1,16 +0,0 @@ | |
| 1 | 
            -
            #!/usr/bin/env ruby
         | 
| 2 | 
            -
            #
         | 
| 3 | 
            -
            # This file was generated by Bundler.
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # The application 'restclient' is installed as part of a gem, and
         | 
| 6 | 
            -
            # this file is here to facilitate running it.
         | 
| 7 | 
            -
            #
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            require 'pathname'
         | 
| 10 | 
            -
            ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
         | 
| 11 | 
            -
              Pathname.new(__FILE__).realpath)
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            require 'rubygems'
         | 
| 14 | 
            -
            require 'bundler/setup'
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            load Gem.bin_path('rest-client', 'restclient')
         | 
    
        data/bin/ri
    DELETED
    
    | @@ -1,16 +0,0 @@ | |
| 1 | 
            -
            #!/usr/bin/env ruby
         | 
| 2 | 
            -
            #
         | 
| 3 | 
            -
            # This file was generated by Bundler.
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # The application 'ri' is installed as part of a gem, and
         | 
| 6 | 
            -
            # this file is here to facilitate running it.
         | 
| 7 | 
            -
            #
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            require 'pathname'
         | 
| 10 | 
            -
            ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
         | 
| 11 | 
            -
              Pathname.new(__FILE__).realpath)
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            require 'rubygems'
         | 
| 14 | 
            -
            require 'bundler/setup'
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            load Gem.bin_path('rdoc', 'ri')
         | 
    
        data/bin/rspec
    DELETED
    
    | @@ -1,16 +0,0 @@ | |
| 1 | 
            -
            #!/usr/bin/env ruby
         | 
| 2 | 
            -
            #
         | 
| 3 | 
            -
            # This file was generated by Bundler.
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # The application 'rspec' is installed as part of a gem, and
         | 
| 6 | 
            -
            # this file is here to facilitate running it.
         | 
| 7 | 
            -
            #
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            require 'pathname'
         | 
| 10 | 
            -
            ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
         | 
| 11 | 
            -
              Pathname.new(__FILE__).realpath)
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            require 'rubygems'
         | 
| 14 | 
            -
            require 'bundler/setup'
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            load Gem.bin_path('rspec-core', 'rspec')
         | 
    
        data/bin/s3sh
    DELETED
    
    | @@ -1,16 +0,0 @@ | |
| 1 | 
            -
            #!/usr/bin/env ruby
         | 
| 2 | 
            -
            #
         | 
| 3 | 
            -
            # This file was generated by Bundler.
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # The application 's3sh' is installed as part of a gem, and
         | 
| 6 | 
            -
            # this file is here to facilitate running it.
         | 
| 7 | 
            -
            #
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            require 'pathname'
         | 
| 10 | 
            -
            ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
         | 
| 11 | 
            -
              Pathname.new(__FILE__).realpath)
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            require 'rubygems'
         | 
| 14 | 
            -
            require 'bundler/setup'
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            load Gem.bin_path('aws-s3', 's3sh')
         | 
    
        data/bin/sequel
    DELETED
    
    | @@ -1,16 +0,0 @@ | |
| 1 | 
            -
            #!/usr/bin/env ruby
         | 
| 2 | 
            -
            #
         | 
| 3 | 
            -
            # This file was generated by Bundler.
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # The application 'sequel' is installed as part of a gem, and
         | 
| 6 | 
            -
            # this file is here to facilitate running it.
         | 
| 7 | 
            -
            #
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            require 'pathname'
         | 
| 10 | 
            -
            ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
         | 
| 11 | 
            -
              Pathname.new(__FILE__).realpath)
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            require 'rubygems'
         | 
| 14 | 
            -
            require 'bundler/setup'
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            load Gem.bin_path('sequel', 'sequel')
         | 
    
        data/bin/serverspec-init
    DELETED
    
    | @@ -1,16 +0,0 @@ | |
| 1 | 
            -
            #!/usr/bin/env ruby
         | 
| 2 | 
            -
            #
         | 
| 3 | 
            -
            # This file was generated by Bundler.
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # The application 'serverspec-init' is installed as part of a gem, and
         | 
| 6 | 
            -
            # this file is here to facilitate running it.
         | 
| 7 | 
            -
            #
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            require 'pathname'
         | 
| 10 | 
            -
            ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
         | 
| 11 | 
            -
              Pathname.new(__FILE__).realpath)
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            require 'rubygems'
         | 
| 14 | 
            -
            require 'bundler/setup'
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            load Gem.bin_path('serverspec', 'serverspec-init')
         | 
    
        data/doc/AccessingSQL.md~
    DELETED
    
    | @@ -1,32 +0,0 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
            Basics:
         | 
| 3 | 
            -
            -------
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            Underneath everything is the Ruby Sequel library; there are a number
         | 
| 6 | 
            -
            of ways to access it.
         | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
            fixie:0 > o.groups.by_name(cl.id).inner.count
         | 
| 11 | 
            -
            1
         | 
| 12 | 
            -
            fixie:0 > o.groups.by_name(cl.id).inner.delete
         | 
| 13 | 
            -
            1
         | 
| 14 | 
            -
            fixie:0 > o.groups.by_name(cl.id).inner.count     
         | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
            * Changing email for user in fixie
         | 
| 18 | 
            -
             | 
| 19 | 
            -
            USERS.by_username('anujbiyani').inner.update(:email=>"anujbiyani01@gmail.com")
         | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
            * Adding a record
         | 
| 24 | 
            -
            ```ruby
         | 
| 25 | 
            -
            u=USERS['a_username']
         | 
| 26 | 
            -
            o=ORGS['an_org']
         | 
| 27 | 
            -
             | 
| 28 | 
            -
            pivotal = USERS['pivotal']
         | 
| 29 | 
            -
             | 
| 30 | 
            -
            ASSOCS.inner.insert(:org_id=>o.id, :user_id=>u.id, :last_updated_by=>pivotal.authz_id,
         | 
| 31 | 
            -
            	:created_at=>:NOW.sql_function, :updated_at=>:NOW.sql_function) )
         | 
| 32 | 
            -
            ```
         | 
    
        data/doc/BulkFixup.md~
    DELETED
    
    | @@ -1,28 +0,0 @@ | |
| 1 | 
            -
            Restoring acl permissions globally
         | 
| 2 | 
            -
            ============
         | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
            * If a key group is deleted (such as users)
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            Create/restore the group
         | 
| 10 | 
            -
             | 
| 11 | 
            -
            Add the users/groups back to the group
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            Set the group ACL appropriately
         | 
| 14 | 
            -
             | 
| 15 | 
            -
            Restore users to the appropriate container ACLs
         | 
| 16 | 
            -
            ```ruby
         | 
| 17 | 
            -
            o = ORGS[THE_ORG]
         | 
| 18 | 
            -
            cl = %w(cookbooks data nodes roles environments policies policy_groups cookbook_artifacts)
         | 
| 19 | 
            -
            cl.each {|c| o.containers[c].ace_add([:create,:read,:update,:delete], o.groups['users']) }
         | 
| 20 | 
            -
            %w(clients).each { |c| o.containers[c].ace_add([:read,:delete], o.groups['users']) }
         | 
| 21 | 
            -
            %w(groups containers).each { |c| o.containers[c].ace_add([:read], o.groups['users']) }
         | 
| 22 | 
            -
            %w(sandboxes).each { |c| o.containers[c].ace_add([:create], o.groups['users']) }
         | 
| 23 | 
            -
            ```
         | 
| 24 | 
            -
             | 
| 25 | 
            -
            Then update the objects from the containers:
         | 
| 26 | 
            -
            ```ruby
         | 
| 27 | 
            -
            Fixie::BulkEditPermissions::copy_from_containers(o)
         | 
| 28 | 
            -
            ```
         | 
    
        data/doc/CommonTasks.md~
    DELETED
    
    | 
            File without changes
         | 
    
        data/doc/GETTING_STARTED.md~
    DELETED
    
    
| @@ -1,26 +0,0 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
            require 'rspec'
         | 
| 3 | 
            -
            require "spec_helper"
         | 
| 4 | 
            -
            require 'fixie'
         | 
| 5 | 
            -
            require 'fixie/config'
         | 
| 6 | 
            -
             | 
| 7 | 
            -
            RSpec.describe Fixie::Sql::Orgs, "Organizations access" do
         | 
| 8 | 
            -
              let (:test_org_name) { "ponyville" }
         | 
| 9 | 
            -
              let (:orgs) { Fixie::Sql::Orgs.new }
         | 
| 10 | 
            -
              let (:test_org) { orgs[test_org_name]}
         | 
| 11 | 
            -
             | 
| 12 | 
            -
              context "Basic functionality of org accessor" do
         | 
| 13 | 
            -
             | 
| 14 | 
            -
                it "Org has a name and id" do
         | 
| 15 | 
            -
                  expect(test_org.name).to eq(test_org_name)
         | 
| 16 | 
            -
                  expect(test_org.id).not_to be_nil
         | 
| 17 | 
            -
                end
         | 
| 18 | 
            -
             | 
| 19 | 
            -
                it "Org has a global admins group" do
         | 
| 20 | 
            -
                  expect(test_org.global_admins.name).to eq(test_org_name + "_global_admins")      
         | 
| 21 | 
            -
                end
         | 
| 22 | 
            -
                
         | 
| 23 | 
            -
              end
         | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
            end
         | 
| @@ -1,34 +0,0 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
            require 'rspec'
         | 
| 3 | 
            -
            require "spec_helper"
         | 
| 4 | 
            -
            require 'fixie'
         | 
| 5 | 
            -
            require 'fixie/config'
         | 
| 6 | 
            -
             | 
| 7 | 
            -
            RSpec.describe Fixie::Sql::Groups, "Group access" do
         | 
| 8 | 
            -
              let (:test_org_name) { "ponyville"}
         | 
| 9 | 
            -
              let (:orgs) { Fixie::Sql::Orgs.new }
         | 
| 10 | 
            -
              let (:users) { Fixie::Sql::Users.new }
         | 
| 11 | 
            -
              let (:test_org) { orgs[test_org_name] }
         | 
| 12 | 
            -
             | 
| 13 | 
            -
              # TODO this should use a freshly created object and purge it afterwords.
         | 
| 14 | 
            -
              # But we need to write the create object feature still
         | 
| 15 | 
            -
              
         | 
| 16 | 
            -
              context "Groups" do
         | 
| 17 | 
            -
                let (:testgroup) { test_org.groups['admins'] }
         | 
| 18 | 
            -
                let (:adminuser) { users['rainbowdash'] }
         | 
| 19 | 
            -
                let (:notadminuser) { users['mary'] }
         | 
| 20 | 
            -
                
         | 
| 21 | 
            -
                it "Members are part of the group" do
         | 
| 22 | 
            -
                  expect(testgroup.member?(adminuser)).to be true
         | 
| 23 | 
            -
                end
         | 
| 24 | 
            -
                it "Members are not part of the group" do
         | 
| 25 | 
            -
                  expect(testgroup.member?(notadminuser)).to be false
         | 
| 26 | 
            -
                end
         | 
| 27 | 
            -
             | 
| 28 | 
            -
                 
         | 
| 29 | 
            -
              end
         | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
            end
         | 
| @@ -1,53 +0,0 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
            require 'rspec'
         | 
| 3 | 
            -
            require "spec_helper"
         | 
| 4 | 
            -
            require 'fixie'
         | 
| 5 | 
            -
            require 'fixie/config'
         | 
| 6 | 
            -
             | 
| 7 | 
            -
            RSpec.describe Fixie::Sql::Orgs, "Organizations access" do
         | 
| 8 | 
            -
              let (:test_org) { "ponyville"}
         | 
| 9 | 
            -
             | 
| 10 | 
            -
              context "Basic access to orgs" do
         | 
| 11 | 
            -
                let (:orgs) { Fixie::Sql::Orgs.new }
         | 
| 12 | 
            -
                it "We find more than one org" do
         | 
| 13 | 
            -
                  expect(orgs.inner.count).to be > 0
         | 
| 14 | 
            -
                end
         | 
| 15 | 
            -
             | 
| 16 | 
            -
                it "We can list orgs" do
         | 
| 17 | 
            -
                  # array matcher requires a splat. (I didn't know this )
         | 
| 18 | 
            -
                  expect(orgs.list).to include( * %w(acme ponyville wonderbolts) )
         | 
| 19 | 
            -
                end
         | 
| 20 | 
            -
                it "We can list orgs with a limit" do
         | 
| 21 | 
            -
                  # array matcher requires a splat. (I didn't know this )
         | 
| 22 | 
            -
                  expect(orgs.list(1)).to eq(:too_many_results)
         | 
| 23 | 
            -
                end
         | 
| 24 | 
            -
             | 
| 25 | 
            -
                it "We can find an org" do
         | 
| 26 | 
            -
                  expect(orgs[test_org].name).to eq(test_org)
         | 
| 27 | 
            -
                end
         | 
| 28 | 
            -
             | 
| 29 | 
            -
              end
         | 
| 30 | 
            -
             | 
| 31 | 
            -
              context "Search accessors work correctly" do
         | 
| 32 | 
            -
                let (:orgs) { Fixie::Sql::Orgs.new }
         | 
| 33 | 
            -
                let (:the_org) { orgs[test_org] }
         | 
| 34 | 
            -
             | 
| 35 | 
            -
                it "We can find an org by name" do
         | 
| 36 | 
            -
                  expect(orgs.by_name(test_org).all.count).to eq(1)
         | 
| 37 | 
            -
                  expect(orgs.by_name(test_org).all.first.name).to eq(the_org.name)
         | 
| 38 | 
            -
                end
         | 
| 39 | 
            -
             | 
| 40 | 
            -
                # TODO: Automatically extract this from the filter by field
         | 
| 41 | 
            -
                %w(name, id, full_name, authz_id).each do |accessor|
         | 
| 42 | 
            -
                  it "We can access an org by #{accessor}" do
         | 
| 43 | 
            -
                    expect(orgs.by_name(test_org).all.count).to eq(1)
         | 
| 44 | 
            -
                    expect(orgs.by_name(test_org).all.first.name).to eq(the_org.name)
         | 
| 45 | 
            -
                  end
         | 
| 46 | 
            -
                end
         | 
| 47 | 
            -
             | 
| 48 | 
            -
              end
         | 
| 49 | 
            -
             | 
| 50 | 
            -
             | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 53 | 
            -
            end
         |