screengem 0.8.1 → 0.9.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 +4 -4
- data/CHANGELOG.md +5 -1
- data/README.md +18 -6
- data/Rakefile +3 -1
- data/lib/screengem.rb +1 -0
- data/lib/screengem/actor.rb +1 -1
- data/lib/screengem/actor_memory.rb +27 -0
- data/lib/screengem/screen_elements.rb +1 -1
- data/lib/screengem/version.rb +1 -1
- metadata +4 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: accc4cf6330e69e04fb0c2ccf8aded873f0cdd6ca7f548f4d15a0acb3d4f1f7d
         | 
| 4 | 
            +
              data.tar.gz: 68c1c36c5b7763557719751f4e58f5890054e79c09d8fc9fe9cc6dc01fd3a45e
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: ca06a1fb1c48d88a12b93f56da624dc082535af69608be82b2547fe9da6f4799724cc2294a7fde8db9ef242ccc7374698c05e5f1c97aeeaf921d89ad2a03e245
         | 
| 7 | 
            +
              data.tar.gz: 6f9ac792ef8b6538a2e1d4829a6ff9d7ad43c33f8bfc45a70ec325f1a03cc1ec0a13ebbdca1820193e82f5512cb2d4fdaf41968756d5cfd926e4165828c28827
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -2,7 +2,11 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            ## master (unreleased)
         | 
| 4 4 |  | 
| 5 | 
            -
            ## 0. | 
| 5 | 
            +
            ## 0.9.0 (2019-09-25)
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            * Support for actor memory outside actor instances (support ParameterType actors)
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            ## 0.8.1 (2019-08-20)
         | 
| 6 10 |  | 
| 7 11 | 
             
            * Support for Rails 6 (only ActiveSupport)
         | 
| 8 12 | 
             
            * Latest development dependencies
         | 
    
        data/README.md
    CHANGED
    
    | @@ -8,11 +8,11 @@ and the questions that the actor asks. | |
| 8 8 | 
             
            ## Example Step Definitions
         | 
| 9 9 |  | 
| 10 10 | 
             
            ```ruby
         | 
| 11 | 
            -
            Given( | 
| 11 | 
            +
            Given("that they are signed in and viewing the {section_name}") do |section_name|
         | 
| 12 12 | 
             
              actor.performs(task.sign_in, task.remember_signature_counter(section_name))
         | 
| 13 13 | 
             
            end
         | 
| 14 14 |  | 
| 15 | 
            -
            Then( | 
| 15 | 
            +
            Then("their signature is captured") do
         | 
| 16 16 | 
             
              actor.asks(question.signature_captured)
         | 
| 17 17 | 
             
            end
         | 
| 18 18 | 
             
            ```
         | 
| @@ -28,12 +28,16 @@ A Task responds to perform and may execute one or more actions. | |
| 28 28 |  | 
| 29 29 | 
             
            
         | 
| 30 30 |  | 
| 31 | 
            -
            ##  | 
| 31 | 
            +
            ## Actor Memory
         | 
| 32 32 |  | 
| 33 | 
            -
             | 
| 33 | 
            +
            Actors are able to remember and recall facts. This is the recommended way to
         | 
| 34 | 
            +
            pass state between steps. To clear all actor's memory before each scenario
         | 
| 35 | 
            +
            add a hook: 
         | 
| 34 36 |  | 
| 35 | 
            -
            ``` | 
| 36 | 
            -
             | 
| 37 | 
            +
            ```
         | 
| 38 | 
            +
            Before do
         | 
| 39 | 
            +
              Screengem::ActorMemory.instance.clear
         | 
| 40 | 
            +
            end
         | 
| 37 41 | 
             
            ```
         | 
| 38 42 |  | 
| 39 43 | 
             
            ## Dampening
         | 
| @@ -49,6 +53,14 @@ To enable and configure dampening perform the following steps: | |
| 49 53 |  | 
| 50 54 | 
             
            To stop dampening, run `unset APPLY_DAMPENING`
         | 
| 51 55 |  | 
| 56 | 
            +
            ## Installation
         | 
| 57 | 
            +
             | 
| 58 | 
            +
            Add this line to your application's Gemfile:
         | 
| 59 | 
            +
             | 
| 60 | 
            +
            ```ruby
         | 
| 61 | 
            +
            gem 'screengem'
         | 
| 62 | 
            +
            ```
         | 
| 63 | 
            +
             | 
| 52 64 | 
             
            ## Development
         | 
| 53 65 |  | 
| 54 66 | 
             
            After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
         | 
    
        data/Rakefile
    CHANGED
    
    
    
        data/lib/screengem.rb
    CHANGED
    
    
    
        data/lib/screengem/actor.rb
    CHANGED
    
    
| @@ -0,0 +1,27 @@ | |
| 1 | 
            +
            module Screengem
         | 
| 2 | 
            +
              #
         | 
| 3 | 
            +
              # Ensures that the memory/recollections that an actor uses are effectively global (using the actor name).
         | 
| 4 | 
            +
              #
         | 
| 5 | 
            +
              # This is required to use Cucumber ParameterTypes because the block arguments are cloned before they are
         | 
| 6 | 
            +
              # provided to the step definitions. This is intentional by the cucumber team to prevent leaking state
         | 
| 7 | 
            +
              # between step definitions. See https://github.com/cucumber/cucumber-ruby/issues/1275.
         | 
| 8 | 
            +
              #
         | 
| 9 | 
            +
              # The cloning of the actor means that is is effectively treated like a value object, and there will be
         | 
| 10 | 
            +
              # many instances of the same actor instantiated in the execution of a single test.
         | 
| 11 | 
            +
              #
         | 
| 12 | 
            +
              class ActorMemory
         | 
| 13 | 
            +
                include ::Singleton
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                def recollections(actor)
         | 
| 16 | 
            +
                  @recollections ||= ActiveSupport::HashWithIndifferentAccess.new
         | 
| 17 | 
            +
                  @recollections[actor.name] ||= ActiveSupport::HashWithIndifferentAccess.new
         | 
| 18 | 
            +
                end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                #
         | 
| 21 | 
            +
                # Use this method to clear actor memory to avoid actor memory persisting across scenarios.
         | 
| 22 | 
            +
                #
         | 
| 23 | 
            +
                def clear
         | 
| 24 | 
            +
                  @recollections = ActiveSupport::HashWithIndifferentAccess.new
         | 
| 25 | 
            +
                end
         | 
| 26 | 
            +
              end
         | 
| 27 | 
            +
            end
         | 
| @@ -29,7 +29,7 @@ module Screengem | |
| 29 29 |  | 
| 30 30 | 
             
                    method_name = class_name.demodulize.underscore
         | 
| 31 31 |  | 
| 32 | 
            -
                    # Create some safety by detecting and failing fast for duplicate creation method names
         | 
| 32 | 
            +
                    # Create some safety by detecting and failing fast for duplicate creation method names.
         | 
| 33 33 | 
             
                    if generated_method_names.include?(method_name)
         | 
| 34 34 | 
             
                      raise "Name collision: two screen elements resolve to '#{method_name}'."
         | 
| 35 35 | 
             
                    end
         | 
    
        data/lib/screengem/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: screengem
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.9.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Alistair McKinnell
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2019- | 
| 11 | 
            +
            date: 2019-09-27 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: activesupport
         | 
| @@ -189,6 +189,7 @@ files: | |
| 189 189 | 
             
            - lib/screengem.rb
         | 
| 190 190 | 
             
            - lib/screengem/action.rb
         | 
| 191 191 | 
             
            - lib/screengem/actor.rb
         | 
| 192 | 
            +
            - lib/screengem/actor_memory.rb
         | 
| 192 193 | 
             
            - lib/screengem/automatic_visit.rb
         | 
| 193 194 | 
             
            - lib/screengem/browser_action.rb
         | 
| 194 195 | 
             
            - lib/screengem/cli.rb
         | 
| @@ -239,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 239 240 | 
             
                - !ruby/object:Gem::Version
         | 
| 240 241 | 
             
                  version: '0'
         | 
| 241 242 | 
             
            requirements: []
         | 
| 242 | 
            -
            rubygems_version: 3.0. | 
| 243 | 
            +
            rubygems_version: 3.0.6
         | 
| 243 244 | 
             
            signing_key: 
         | 
| 244 245 | 
             
            specification_version: 4
         | 
| 245 246 | 
             
            summary: Ruby implementation of the Screengem Pattern.
         |