black_and_white 0.1.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 +7 -0
 - data/.gitignore +9 -0
 - data/.rspec +2 -0
 - data/.ruby-version +1 -0
 - data/.travis.yml +4 -0
 - data/CODE_OF_CONDUCT.md +49 -0
 - data/Gemfile +5 -0
 - data/LICENSE.txt +21 -0
 - data/README.md +81 -0
 - data/Rakefile +6 -0
 - data/bin/console +23 -0
 - data/bin/setup +8 -0
 - data/black_and_white.gemspec +38 -0
 - data/codecov.yml +2 -0
 - data/lib/black_and_white/active_record/error.rb +5 -0
 - data/lib/black_and_white/active_record/test.rb +26 -0
 - data/lib/black_and_white/active_record.rb +54 -0
 - data/lib/black_and_white/config.rb +21 -0
 - data/lib/black_and_white/helpers/database.rb +46 -0
 - data/lib/black_and_white/helpers/utils.rb +19 -0
 - data/lib/black_and_white/hooks.rb +10 -0
 - data/lib/black_and_white/mongoid.rb +1 -0
 - data/lib/black_and_white/version.rb +3 -0
 - data/lib/black_and_white.rb +12 -0
 - data/lib/generators/black_and_white/config_generator.rb +16 -0
 - data/lib/generators/black_and_white/migrations_generator.rb +37 -0
 - data/lib/generators/black_and_white/templates/black_and_white_config.rb +7 -0
 - data/lib/generators/black_and_white/templates/create_ab_tests_migration.rb +7 -0
 - data/lib/generators/black_and_white/templates/create_ab_tests_relation_migration.rb +7 -0
 - metadata +184 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 7094bc50b6c139b58a5bbe7caf4aec07e6e8b8d4
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: df36e8810b2c8492c8aca71980711aebb503008c
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 363fa7faa02e5472b2507457e5131f2c2038c25f1511df53582fa1427914544802099dc947b6462957e9769e4f030f0261245822067733078cdfce2b24436721
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 01ce6b037748b9abb1f70b893f9ac677d722d49e8f5f61a34422497b6a162e28dc6f020c935a54f15c1fb816ada088208eef57264f02b8a5d7c6ef30ce933875
         
     | 
    
        data/.gitignore
    ADDED
    
    
    
        data/.rspec
    ADDED
    
    
    
        data/.ruby-version
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            2.3.0
         
     | 
    
        data/.travis.yml
    ADDED
    
    
    
        data/CODE_OF_CONDUCT.md
    ADDED
    
    | 
         @@ -0,0 +1,49 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Contributor Code of Conduct
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            As contributors and maintainers of this project, and in the interest of
         
     | 
| 
      
 4 
     | 
    
         
            +
            fostering an open and welcoming community, we pledge to respect all people who
         
     | 
| 
      
 5 
     | 
    
         
            +
            contribute through reporting issues, posting feature requests, updating
         
     | 
| 
      
 6 
     | 
    
         
            +
            documentation, submitting pull requests or patches, and other activities.
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            We are committed to making participation in this project a harassment-free
         
     | 
| 
      
 9 
     | 
    
         
            +
            experience for everyone, regardless of level of experience, gender, gender
         
     | 
| 
      
 10 
     | 
    
         
            +
            identity and expression, sexual orientation, disability, personal appearance,
         
     | 
| 
      
 11 
     | 
    
         
            +
            body size, race, ethnicity, age, religion, or nationality.
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            Examples of unacceptable behavior by participants include:
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            * The use of sexualized language or imagery
         
     | 
| 
      
 16 
     | 
    
         
            +
            * Personal attacks
         
     | 
| 
      
 17 
     | 
    
         
            +
            * Trolling or insulting/derogatory comments
         
     | 
| 
      
 18 
     | 
    
         
            +
            * Public or private harassment
         
     | 
| 
      
 19 
     | 
    
         
            +
            * Publishing other's private information, such as physical or electronic
         
     | 
| 
      
 20 
     | 
    
         
            +
              addresses, without explicit permission
         
     | 
| 
      
 21 
     | 
    
         
            +
            * Other unethical or unprofessional conduct
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            Project maintainers have the right and responsibility to remove, edit, or
         
     | 
| 
      
 24 
     | 
    
         
            +
            reject comments, commits, code, wiki edits, issues, and other contributions
         
     | 
| 
      
 25 
     | 
    
         
            +
            that are not aligned to this Code of Conduct, or to ban temporarily or
         
     | 
| 
      
 26 
     | 
    
         
            +
            permanently any contributor for other behaviors that they deem inappropriate,
         
     | 
| 
      
 27 
     | 
    
         
            +
            threatening, offensive, or harmful.
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            By adopting this Code of Conduct, project maintainers commit themselves to
         
     | 
| 
      
 30 
     | 
    
         
            +
            fairly and consistently applying these principles to every aspect of managing
         
     | 
| 
      
 31 
     | 
    
         
            +
            this project. Project maintainers who do not follow or enforce the Code of
         
     | 
| 
      
 32 
     | 
    
         
            +
            Conduct may be permanently removed from the project team.
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            This code of conduct applies both within project spaces and in public spaces
         
     | 
| 
      
 35 
     | 
    
         
            +
            when an individual is representing the project or its community.
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            Instances of abusive, harassing, or otherwise unacceptable behavior may be
         
     | 
| 
      
 38 
     | 
    
         
            +
            reported by contacting a project maintainer at wizard.oneandonly@gmail.com. All
         
     | 
| 
      
 39 
     | 
    
         
            +
            complaints will be reviewed and investigated and will result in a response that
         
     | 
| 
      
 40 
     | 
    
         
            +
            is deemed necessary and appropriate to the circumstances. Maintainers are
         
     | 
| 
      
 41 
     | 
    
         
            +
            obligated to maintain confidentiality with regard to the reporter of an
         
     | 
| 
      
 42 
     | 
    
         
            +
            incident.
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            This Code of Conduct is adapted from the [Contributor Covenant][homepage],
         
     | 
| 
      
 45 
     | 
    
         
            +
            version 1.3.0, available at
         
     | 
| 
      
 46 
     | 
    
         
            +
            [http://contributor-covenant.org/version/1/3/0/][version]
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            [homepage]: http://contributor-covenant.org
         
     | 
| 
      
 49 
     | 
    
         
            +
            [version]: http://contributor-covenant.org/version/1/3/0/
         
     | 
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE.txt
    ADDED
    
    | 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            The MIT License (MIT)
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Copyright (c) 2016 Stefan Slaveykov
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
      
 6 
     | 
    
         
            +
            of this software and associated documentation files (the "Software"), to deal
         
     | 
| 
      
 7 
     | 
    
         
            +
            in the Software without restriction, including without limitation the rights
         
     | 
| 
      
 8 
     | 
    
         
            +
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         
     | 
| 
      
 9 
     | 
    
         
            +
            copies of the Software, and to permit persons to whom the Software is
         
     | 
| 
      
 10 
     | 
    
         
            +
            furnished to do so, subject to the following conditions:
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be included in
         
     | 
| 
      
 13 
     | 
    
         
            +
            all copies or substantial portions of the Software.
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
      
 16 
     | 
    
         
            +
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         
     | 
| 
      
 17 
     | 
    
         
            +
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         
     | 
| 
      
 18 
     | 
    
         
            +
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         
     | 
| 
      
 19 
     | 
    
         
            +
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         
     | 
| 
      
 20 
     | 
    
         
            +
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         
     | 
| 
      
 21 
     | 
    
         
            +
            THE SOFTWARE.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,81 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # BlackAndWhite
         
     | 
| 
      
 2 
     | 
    
         
            +
            [](https://travis-ci.org/wizardone/black_and_white)
         
     | 
| 
      
 3 
     | 
    
         
            +
            [](https://codecov.io/gh/wizardone/black_and_white)
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            ### A/B Testing made easy
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            Add this line to your application's Gemfile:
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 13 
     | 
    
         
            +
            gem 'black_and_white'
         
     | 
| 
      
 14 
     | 
    
         
            +
            ```
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            And then execute:
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                $ bundle
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            Or install it yourself as:
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                $ gem install black_and_white
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            ## Usage
         
     | 
| 
      
 25 
     | 
    
         
            +
            Black And White is meant to work with Rails for the moment. In order to
         
     | 
| 
      
 26 
     | 
    
         
            +
            use it first run:
         
     | 
| 
      
 27 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 28 
     | 
    
         
            +
            rails g black_and_white:config
         
     | 
| 
      
 29 
     | 
    
         
            +
            ```
         
     | 
| 
      
 30 
     | 
    
         
            +
            this will create a `black_and_white.rb` config file in
         
     | 
| 
      
 31 
     | 
    
         
            +
            `config/initializers` with some default values. The file looks like this:
         
     | 
| 
      
 32 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 33 
     | 
    
         
            +
            BlackAndWhite.configure do |config|
         
     | 
| 
      
 34 
     | 
    
         
            +
              config.bw_class = 'User'
         
     | 
| 
      
 35 
     | 
    
         
            +
              config.bw_class_table = :users
         
     | 
| 
      
 36 
     | 
    
         
            +
              config.bw_main_table = :ab_test
         
     | 
| 
      
 37 
     | 
    
         
            +
              config.bw_join_table = :ab_tests_users
         
     | 
| 
      
 38 
     | 
    
         
            +
            end
         
     | 
| 
      
 39 
     | 
    
         
            +
              
         
     | 
| 
      
 40 
     | 
    
         
            +
            BlackAndWhite::Hooks.init
         
     | 
| 
      
 41 
     | 
    
         
            +
            ```
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
            After this run:
         
     | 
| 
      
 44 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 45 
     | 
    
         
            +
            rails g black_and_white:migrations
         
     | 
| 
      
 46 
     | 
    
         
            +
            ```
         
     | 
| 
      
 47 
     | 
    
         
            +
            this will create the necessary migrations in the `db/migrate` folder.
         
     | 
| 
      
 48 
     | 
    
         
            +
            Review them and then feel free to migrate.
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            ### For ActiveRecord objects:
         
     | 
| 
      
 51 
     | 
    
         
            +
            Include the black_and_white module for activerecord interactions:
         
     | 
| 
      
 52 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 53 
     | 
    
         
            +
            class User < ActiveRecord::Base
         
     | 
| 
      
 54 
     | 
    
         
            +
              include BlackAndWhite::ActiveRecord
         
     | 
| 
      
 55 
     | 
    
         
            +
            end
         
     | 
| 
      
 56 
     | 
    
         
            +
            ```
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
            To create a new A/B test you can run:
         
     | 
| 
      
 59 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 60 
     | 
    
         
            +
            BlackAndWhite.create(name: 'My Test', active: true)
         
     | 
| 
      
 61 
     | 
    
         
            +
            ```
         
     | 
| 
      
 62 
     | 
    
         
            +
            By default all created tests are inactive.
         
     | 
| 
      
 63 
     | 
    
         
            +
            To add existing users (or any other object) to the A/B Test you can call:
         
     | 
| 
      
 64 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 65 
     | 
    
         
            +
            user.ab_participate!('My Test')
         
     | 
| 
      
 66 
     | 
    
         
            +
            ```
         
     | 
| 
      
 67 
     | 
    
         
            +
            You can also supply an additional block which is evaluated:
         
     | 
| 
      
 68 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 69 
     | 
    
         
            +
            user.ab_participate!('My Test') do |user|
         
     | 
| 
      
 70 
     | 
    
         
            +
              user.admin? # returns true, user is added to the ab test
         
     | 
| 
      
 71 
     | 
    
         
            +
            end
         
     | 
| 
      
 72 
     | 
    
         
            +
            ```
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
            ## Contributing
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
            Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/black_and_white. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
            ## License
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
            The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
         
     | 
    
        data/Rakefile
    ADDED
    
    
    
        data/bin/console
    ADDED
    
    | 
         @@ -0,0 +1,23 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "bundler/setup"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "black_and_white/config"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            # You can add fixtures and/or initialization code here to make experimenting
         
     | 
| 
      
 7 
     | 
    
         
            +
            # with your gem easier. You can also use a different console, if you like.
         
     | 
| 
      
 8 
     | 
    
         
            +
            BlackAndWhite.configure do |config|
         
     | 
| 
      
 9 
     | 
    
         
            +
              config.bw_class = 'User'
         
     | 
| 
      
 10 
     | 
    
         
            +
              config.bw_class_table = :users
         
     | 
| 
      
 11 
     | 
    
         
            +
              config.bw_main_table = :ab_tests
         
     | 
| 
      
 12 
     | 
    
         
            +
              config.bw_join_table = :ab_tests_users
         
     | 
| 
      
 13 
     | 
    
         
            +
            end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            require "black_and_white"
         
     | 
| 
      
 16 
     | 
    
         
            +
            require "black_and_white/active_record/participant"
         
     | 
| 
      
 17 
     | 
    
         
            +
            require "black_and_white/active_record/test"
         
     | 
| 
      
 18 
     | 
    
         
            +
            # (If you use this, don't forget to add pry to your Gemfile!)
         
     | 
| 
      
 19 
     | 
    
         
            +
            # require "pry"
         
     | 
| 
      
 20 
     | 
    
         
            +
            # Pry.start
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            require "irb"
         
     | 
| 
      
 23 
     | 
    
         
            +
            IRB.start
         
     | 
    
        data/bin/setup
    ADDED
    
    
| 
         @@ -0,0 +1,38 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # coding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
            lib = File.expand_path('../lib', __FILE__)
         
     | 
| 
      
 3 
     | 
    
         
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'black_and_white/version'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            Gem::Specification.new do |spec|
         
     | 
| 
      
 7 
     | 
    
         
            +
              spec.name          = "black_and_white"
         
     | 
| 
      
 8 
     | 
    
         
            +
              spec.version       = BlackAndWhite::VERSION
         
     | 
| 
      
 9 
     | 
    
         
            +
              spec.authors       = ["Stefan Slaveykov"]
         
     | 
| 
      
 10 
     | 
    
         
            +
              spec.email         = ["wizard.oneandonly@gmail.com"]
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              spec.summary       = %q{A/B testing for ActiveRecord}
         
     | 
| 
      
 13 
     | 
    
         
            +
              spec.description   = %q{A/B testing made easy}
         
     | 
| 
      
 14 
     | 
    
         
            +
              spec.homepage      = "https://github.com/wizardone/black_and_white"
         
     | 
| 
      
 15 
     | 
    
         
            +
              spec.license       = "MIT"
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
         
     | 
| 
      
 18 
     | 
    
         
            +
              # delete this section to allow pushing this gem to any host.
         
     | 
| 
      
 19 
     | 
    
         
            +
              if spec.respond_to?(:metadata)
         
     | 
| 
      
 20 
     | 
    
         
            +
                #spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
         
     | 
| 
      
 21 
     | 
    
         
            +
              else
         
     | 
| 
      
 22 
     | 
    
         
            +
                raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
         
     | 
| 
      
 23 
     | 
    
         
            +
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
              spec.files         = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
         
     | 
| 
      
 26 
     | 
    
         
            +
              spec.bindir        = "exe"
         
     | 
| 
      
 27 
     | 
    
         
            +
              spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
         
     | 
| 
      
 28 
     | 
    
         
            +
              spec.require_paths = ["lib"]
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
              spec.add_development_dependency "bundler", "~> 1.11"
         
     | 
| 
      
 31 
     | 
    
         
            +
              spec.add_development_dependency "rake", "~> 10.0"
         
     | 
| 
      
 32 
     | 
    
         
            +
              spec.add_development_dependency "rspec", "~> 3.0"
         
     | 
| 
      
 33 
     | 
    
         
            +
              spec.add_development_dependency "activerecord", "~> 4.2"
         
     | 
| 
      
 34 
     | 
    
         
            +
              spec.add_development_dependency "activesupport", "~> 4.2"
         
     | 
| 
      
 35 
     | 
    
         
            +
              spec.add_development_dependency "pg"
         
     | 
| 
      
 36 
     | 
    
         
            +
              spec.add_development_dependency "byebug"
         
     | 
| 
      
 37 
     | 
    
         
            +
              spec.add_development_dependency 'database_cleaner'
         
     | 
| 
      
 38 
     | 
    
         
            +
            end
         
     | 
    
        data/codecov.yml
    ADDED
    
    
| 
         @@ -0,0 +1,26 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'active_record'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'active_support/inflector'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'black_and_white/helpers/database'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module BlackAndWhite
         
     | 
| 
      
 6 
     | 
    
         
            +
              module ActiveRecord
         
     | 
| 
      
 7 
     | 
    
         
            +
                class Test < ::ActiveRecord::Base
         
     | 
| 
      
 8 
     | 
    
         
            +
                  self.table_name = BlackAndWhite.config.bw_main_table.to_s.pluralize
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  validates :name, uniqueness: true
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                  has_and_belongs_to_many BlackAndWhite.config.bw_class_table,
         
     | 
| 
      
 13 
     | 
    
         
            +
                                          join_table: BlackAndWhite.config.bw_join_table
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                  def activate!
         
     | 
| 
      
 16 
     | 
    
         
            +
                    self.active = true
         
     | 
| 
      
 17 
     | 
    
         
            +
                    save!
         
     | 
| 
      
 18 
     | 
    
         
            +
                  end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                  def deactivate!
         
     | 
| 
      
 21 
     | 
    
         
            +
                    self.active = false
         
     | 
| 
      
 22 
     | 
    
         
            +
                    save!
         
     | 
| 
      
 23 
     | 
    
         
            +
                  end
         
     | 
| 
      
 24 
     | 
    
         
            +
                end
         
     | 
| 
      
 25 
     | 
    
         
            +
              end
         
     | 
| 
      
 26 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,54 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'active_support/concern'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module BlackAndWhite
         
     | 
| 
      
 4 
     | 
    
         
            +
              module ActiveRecord
         
     | 
| 
      
 5 
     | 
    
         
            +
                extend ActiveSupport::Concern
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                included do
         
     | 
| 
      
 8 
     | 
    
         
            +
                  has_and_belongs_to_many :ab_tests,
         
     | 
| 
      
 9 
     | 
    
         
            +
                                          class_name: '::BlackAndWhite::ActiveRecord::Test',
         
     | 
| 
      
 10 
     | 
    
         
            +
                                          join_table: BlackAndWhite.config.bw_join_table,
         
     | 
| 
      
 11 
     | 
    
         
            +
                                          association_foreign_key: :ab_test_id
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                  attr_reader :ab_test, :options
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                  def ab_participate!(test_name, **options, &block)
         
     | 
| 
      
 16 
     | 
    
         
            +
                    @options = options
         
     | 
| 
      
 17 
     | 
    
         
            +
                    if (@ab_test = fetch_ab_test(test_name)).present?
         
     | 
| 
      
 18 
     | 
    
         
            +
                      conditions = true
         
     | 
| 
      
 19 
     | 
    
         
            +
                      conditions = yield(self) if block_given?
         
     | 
| 
      
 20 
     | 
    
         
            +
                      update_participant if conditions
         
     | 
| 
      
 21 
     | 
    
         
            +
                    else
         
     | 
| 
      
 22 
     | 
    
         
            +
                      missing_ab_test(test_name)
         
     | 
| 
      
 23 
     | 
    
         
            +
                    end
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                  def ab_participates?(test_name)
         
     | 
| 
      
 27 
     | 
    
         
            +
                    ab_tests.detect { |ab_test| ab_test.name == test_name }.present?
         
     | 
| 
      
 28 
     | 
    
         
            +
                  end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                  private
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                  def update_participant
         
     | 
| 
      
 33 
     | 
    
         
            +
                    ab_tests << ab_test
         
     | 
| 
      
 34 
     | 
    
         
            +
                  end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                  def missing_ab_test(test_name)
         
     | 
| 
      
 37 
     | 
    
         
            +
                    unless options[:raise_on_missing]
         
     | 
| 
      
 38 
     | 
    
         
            +
                      return false
         
     | 
| 
      
 39 
     | 
    
         
            +
                    end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                    raise AbTestError, "no A/B Test with name #{test_name} exists or it is not active"
         
     | 
| 
      
 42 
     | 
    
         
            +
                  end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                  def fetch_ab_test(name)
         
     | 
| 
      
 45 
     | 
    
         
            +
                    query = { name: name }
         
     | 
| 
      
 46 
     | 
    
         
            +
                    if options[:join_inactive] == false
         
     | 
| 
      
 47 
     | 
    
         
            +
                      query.merge!(active: true)
         
     | 
| 
      
 48 
     | 
    
         
            +
                    end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                    BlackAndWhite::ActiveRecord::Test.find_by(query)
         
     | 
| 
      
 51 
     | 
    
         
            +
                  end
         
     | 
| 
      
 52 
     | 
    
         
            +
                end
         
     | 
| 
      
 53 
     | 
    
         
            +
              end
         
     | 
| 
      
 54 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module BlackAndWhite
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
              def self.configure(&block)
         
     | 
| 
      
 4 
     | 
    
         
            +
                yield config
         
     | 
| 
      
 5 
     | 
    
         
            +
              end
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              def self.config
         
     | 
| 
      
 8 
     | 
    
         
            +
                @config ||= BlackAndWhite::Config.new
         
     | 
| 
      
 9 
     | 
    
         
            +
              end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
              class Config
         
     | 
| 
      
 12 
     | 
    
         
            +
                attr_accessor :bw_main_table, :bw_join_table, :bw_class, :bw_class_table
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                def initialize
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @bw_main_table = :ab_tests
         
     | 
| 
      
 16 
     | 
    
         
            +
                  @bw_join_table = :ab_tests_users
         
     | 
| 
      
 17 
     | 
    
         
            +
                  @bw_class = 'User'
         
     | 
| 
      
 18 
     | 
    
         
            +
                  @bw_class_table = :users
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
              end
         
     | 
| 
      
 21 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,46 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module BlackAndWhite
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Helpers
         
     | 
| 
      
 3 
     | 
    
         
            +
                module Database
         
     | 
| 
      
 4 
     | 
    
         
            +
                  def bw_tests_table_name_pluralize
         
     | 
| 
      
 5 
     | 
    
         
            +
                    BlackAndWhite.config.bw_main_table.to_s.pluralize
         
     | 
| 
      
 6 
     | 
    
         
            +
                  end
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                  def bw_tests_table_data
         
     | 
| 
      
 9 
     | 
    
         
            +
                    <<RUBY
         
     | 
| 
      
 10 
     | 
    
         
            +
                      t.string :name, unique: true, null: false
         
     | 
| 
      
 11 
     | 
    
         
            +
                      t.boolean :active, default: false
         
     | 
| 
      
 12 
     | 
    
         
            +
                      t.timestamps null: false
         
     | 
| 
      
 13 
     | 
    
         
            +
            RUBY
         
     | 
| 
      
 14 
     | 
    
         
            +
                  end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                  def bw_relations_table_data
         
     | 
| 
      
 17 
     | 
    
         
            +
                    <<RUBY
         
     | 
| 
      
 18 
     | 
    
         
            +
                    t.references :#{bw_tests_class_table}, index: true
         
     | 
| 
      
 19 
     | 
    
         
            +
                    t.references :#{bw_tests_table_name_pluralize}, index: true
         
     | 
| 
      
 20 
     | 
    
         
            +
            RUBY
         
     | 
| 
      
 21 
     | 
    
         
            +
                  end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                  def bw_relations_table_name
         
     | 
| 
      
 24 
     | 
    
         
            +
                    BlackAndWhite.config.bw_join_table
         
     | 
| 
      
 25 
     | 
    
         
            +
                  end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                  def bw_tests_table_name
         
     | 
| 
      
 28 
     | 
    
         
            +
                    BlackAndWhite.config.bw_main_table
         
     | 
| 
      
 29 
     | 
    
         
            +
                  end
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                  def bw_tests_class
         
     | 
| 
      
 32 
     | 
    
         
            +
                    BlackAndWhite.config.bw_class
         
     | 
| 
      
 33 
     | 
    
         
            +
                  end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                  def bw_tests_class_table
         
     | 
| 
      
 36 
     | 
    
         
            +
                    BlackAndWhite.config.bw_class_table
         
     | 
| 
      
 37 
     | 
    
         
            +
                  end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                  def migration_version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    if defined?(::Rails) && ::Rails.version.start_with?('5')
         
     | 
| 
      
 41 
     | 
    
         
            +
                      "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
         
     | 
| 
      
 42 
     | 
    
         
            +
                    end
         
     | 
| 
      
 43 
     | 
    
         
            +
                  end
         
     | 
| 
      
 44 
     | 
    
         
            +
                end
         
     | 
| 
      
 45 
     | 
    
         
            +
              end
         
     | 
| 
      
 46 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,19 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module BlackAndWhite
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Helpers
         
     | 
| 
      
 3 
     | 
    
         
            +
                module Utils
         
     | 
| 
      
 4 
     | 
    
         
            +
                  extend self
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                  def active_record_4?
         
     | 
| 
      
 7 
     | 
    
         
            +
                    ::ActiveRecord::VERSION::MAJOR == 4
         
     | 
| 
      
 8 
     | 
    
         
            +
                  end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  def active_record_5?
         
     | 
| 
      
 11 
     | 
    
         
            +
                    ::ActiveRecord::VERSION::MAJOR == 5
         
     | 
| 
      
 12 
     | 
    
         
            +
                  end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                  def active_record_3?
         
     | 
| 
      
 15 
     | 
    
         
            +
                    ::ActiveRecord::VERSION::MAJOR == 3
         
     | 
| 
      
 16 
     | 
    
         
            +
                  end
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Implement me at some point, please
         
     | 
| 
         @@ -0,0 +1,12 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "black_and_white/version"
         
     | 
| 
      
 2 
     | 
    
         
            +
            require "black_and_white/config"
         
     | 
| 
      
 3 
     | 
    
         
            +
            require "black_and_white/hooks"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "black_and_white/active_record"
         
     | 
| 
      
 5 
     | 
    
         
            +
            require "black_and_white/active_record/error"
         
     | 
| 
      
 6 
     | 
    
         
            +
            require "black_and_white/helpers/utils"
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            module BlackAndWhite
         
     | 
| 
      
 9 
     | 
    
         
            +
              def self.create(args = {})
         
     | 
| 
      
 10 
     | 
    
         
            +
                ActiveRecord::Test.create(args)
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,16 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module BlackAndWhite
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Generators
         
     | 
| 
      
 3 
     | 
    
         
            +
                class ConfigGenerator < Rails::Generators::Base
         
     | 
| 
      
 4 
     | 
    
         
            +
                  source_root File.expand_path('../templates', __FILE__)
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                  desc  <<DESC
         
     | 
| 
      
 7 
     | 
    
         
            +
                    Generator that copies the default BlackAndWhite config into the
         
     | 
| 
      
 8 
     | 
    
         
            +
                    initializers folder
         
     | 
| 
      
 9 
     | 
    
         
            +
            DESC
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                  def copy_config
         
     | 
| 
      
 12 
     | 
    
         
            +
                    copy_file 'black_and_white_config.rb', 'config/initializers/black_and_white.rb'
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
              end
         
     | 
| 
      
 16 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,37 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #require 'active_record/generators/migration'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'rails/generators/active_record'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'black_and_white/helpers/database'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module BlackAndWhite
         
     | 
| 
      
 6 
     | 
    
         
            +
              module Generators
         
     | 
| 
      
 7 
     | 
    
         
            +
                class MigrationsGenerator < Rails::Generators::Base # ActiveRecord::Generators::Base
         
     | 
| 
      
 8 
     | 
    
         
            +
                  include Rails::Generators::Migration
         
     | 
| 
      
 9 
     | 
    
         
            +
                  include BlackAndWhite::Helpers::Database
         
     | 
| 
      
 10 
     | 
    
         
            +
                  # include ActiveRecord::Generators::Migration
         
     | 
| 
      
 11 
     | 
    
         
            +
                  # For some reason including ActiveRecord::Generators::Migration causes
         
     | 
| 
      
 12 
     | 
    
         
            +
                  # the generator to not appear when calling `rails g`.
         
     | 
| 
      
 13 
     | 
    
         
            +
                  # ActiveRecord::Generators::Migration already implements the `next_migration_number` and
         
     | 
| 
      
 14 
     | 
    
         
            +
                  # includes Rails::Generators::Migration in itself, so it woulda been a lot easier to just include
         
     | 
| 
      
 15 
     | 
    
         
            +
                  # it here. However this does not seem possible so we just evaluate the same method directly in
         
     | 
| 
      
 16 
     | 
    
         
            +
                  # Rails::Generators::Migration
         
     | 
| 
      
 17 
     | 
    
         
            +
                  Rails::Generators::Migration::ClassMethods.class_eval do
         
     | 
| 
      
 18 
     | 
    
         
            +
                    def next_migration_number(dirname)
         
     | 
| 
      
 19 
     | 
    
         
            +
                      next_migration_number = current_migration_number(dirname) + 1
         
     | 
| 
      
 20 
     | 
    
         
            +
                      ::ActiveRecord::Migration.next_migration_number(next_migration_number)
         
     | 
| 
      
 21 
     | 
    
         
            +
                    end
         
     | 
| 
      
 22 
     | 
    
         
            +
                  end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                  source_root File.expand_path('../templates', __FILE__)
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                  desc  <<DESC
         
     | 
| 
      
 27 
     | 
    
         
            +
                    Generator that copies the migrations for generating the a/b tests database table and relations into the
         
     | 
| 
      
 28 
     | 
    
         
            +
                    main db/migrate workspace
         
     | 
| 
      
 29 
     | 
    
         
            +
            DESC
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                  def copy_migration
         
     | 
| 
      
 32 
     | 
    
         
            +
                    migration_template 'create_ab_tests_migration.rb', "db/migrate/create_#{bw_tests_table_name_pluralize}.rb", migration_version: migration_version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    migration_template 'create_ab_tests_relation_migration.rb', "db/migrate/create_#{bw_relations_table_name}.rb", migration_version: migration_version
         
     | 
| 
      
 34 
     | 
    
         
            +
                  end
         
     | 
| 
      
 35 
     | 
    
         
            +
                end
         
     | 
| 
      
 36 
     | 
    
         
            +
              end
         
     | 
| 
      
 37 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,184 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: black_and_white
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.0
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Stefan Slaveykov
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: exe
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-09-22 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: bundler
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '1.11'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '1.11'
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
      
 41 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 42 
     | 
    
         
            +
              name: rspec
         
     | 
| 
      
 43 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 44 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 46 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 47 
     | 
    
         
            +
                    version: '3.0'
         
     | 
| 
      
 48 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 49 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 50 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 51 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 52 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 53 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 54 
     | 
    
         
            +
                    version: '3.0'
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: activerecord
         
     | 
| 
      
 57 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 58 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '4.2'
         
     | 
| 
      
 62 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 63 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 64 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 65 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 66 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 67 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 68 
     | 
    
         
            +
                    version: '4.2'
         
     | 
| 
      
 69 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 70 
     | 
    
         
            +
              name: activesupport
         
     | 
| 
      
 71 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 72 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 73 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 74 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 75 
     | 
    
         
            +
                    version: '4.2'
         
     | 
| 
      
 76 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 77 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 78 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 79 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 80 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 81 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 82 
     | 
    
         
            +
                    version: '4.2'
         
     | 
| 
      
 83 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 84 
     | 
    
         
            +
              name: pg
         
     | 
| 
      
 85 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 86 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 87 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 88 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 89 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 90 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 91 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 92 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 93 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 94 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 95 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 96 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 97 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 98 
     | 
    
         
            +
              name: byebug
         
     | 
| 
      
 99 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 100 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 101 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 102 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 103 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 104 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 105 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 106 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 107 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 108 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 109 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 110 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 111 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 112 
     | 
    
         
            +
              name: database_cleaner
         
     | 
| 
      
 113 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 114 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 115 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 116 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 117 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 118 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 119 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 120 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 121 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 122 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 123 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 124 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 125 
     | 
    
         
            +
            description: A/B testing made easy
         
     | 
| 
      
 126 
     | 
    
         
            +
            email:
         
     | 
| 
      
 127 
     | 
    
         
            +
            - wizard.oneandonly@gmail.com
         
     | 
| 
      
 128 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 129 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 130 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 131 
     | 
    
         
            +
            files:
         
     | 
| 
      
 132 
     | 
    
         
            +
            - ".gitignore"
         
     | 
| 
      
 133 
     | 
    
         
            +
            - ".rspec"
         
     | 
| 
      
 134 
     | 
    
         
            +
            - ".ruby-version"
         
     | 
| 
      
 135 
     | 
    
         
            +
            - ".travis.yml"
         
     | 
| 
      
 136 
     | 
    
         
            +
            - CODE_OF_CONDUCT.md
         
     | 
| 
      
 137 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 138 
     | 
    
         
            +
            - LICENSE.txt
         
     | 
| 
      
 139 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 140 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 141 
     | 
    
         
            +
            - bin/console
         
     | 
| 
      
 142 
     | 
    
         
            +
            - bin/setup
         
     | 
| 
      
 143 
     | 
    
         
            +
            - black_and_white.gemspec
         
     | 
| 
      
 144 
     | 
    
         
            +
            - codecov.yml
         
     | 
| 
      
 145 
     | 
    
         
            +
            - lib/black_and_white.rb
         
     | 
| 
      
 146 
     | 
    
         
            +
            - lib/black_and_white/active_record.rb
         
     | 
| 
      
 147 
     | 
    
         
            +
            - lib/black_and_white/active_record/error.rb
         
     | 
| 
      
 148 
     | 
    
         
            +
            - lib/black_and_white/active_record/test.rb
         
     | 
| 
      
 149 
     | 
    
         
            +
            - lib/black_and_white/config.rb
         
     | 
| 
      
 150 
     | 
    
         
            +
            - lib/black_and_white/helpers/database.rb
         
     | 
| 
      
 151 
     | 
    
         
            +
            - lib/black_and_white/helpers/utils.rb
         
     | 
| 
      
 152 
     | 
    
         
            +
            - lib/black_and_white/hooks.rb
         
     | 
| 
      
 153 
     | 
    
         
            +
            - lib/black_and_white/mongoid.rb
         
     | 
| 
      
 154 
     | 
    
         
            +
            - lib/black_and_white/version.rb
         
     | 
| 
      
 155 
     | 
    
         
            +
            - lib/generators/black_and_white/config_generator.rb
         
     | 
| 
      
 156 
     | 
    
         
            +
            - lib/generators/black_and_white/migrations_generator.rb
         
     | 
| 
      
 157 
     | 
    
         
            +
            - lib/generators/black_and_white/templates/black_and_white_config.rb
         
     | 
| 
      
 158 
     | 
    
         
            +
            - lib/generators/black_and_white/templates/create_ab_tests_migration.rb
         
     | 
| 
      
 159 
     | 
    
         
            +
            - lib/generators/black_and_white/templates/create_ab_tests_relation_migration.rb
         
     | 
| 
      
 160 
     | 
    
         
            +
            homepage: https://github.com/wizardone/black_and_white
         
     | 
| 
      
 161 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 162 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 163 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 164 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 165 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 166 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 167 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 168 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 169 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 170 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 171 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 172 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 173 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 174 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 175 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 176 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 177 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 178 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 179 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 180 
     | 
    
         
            +
            rubygems_version: 2.5.1
         
     | 
| 
      
 181 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 182 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 183 
     | 
    
         
            +
            summary: A/B testing for ActiveRecord
         
     | 
| 
      
 184 
     | 
    
         
            +
            test_files: []
         
     |