frameworks-capybara 0.0.37 → 0.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            0.0. | 
| 1 | 
            +
            0.0.38
         | 
    
        data/frameworks-capybara.gemspec
    CHANGED
    
    | @@ -5,11 +5,11 @@ | |
| 5 5 |  | 
| 6 6 | 
             
            Gem::Specification.new do |s|
         | 
| 7 7 | 
             
              s.name = %q{frameworks-capybara}
         | 
| 8 | 
            -
              s.version = "0.0. | 
| 8 | 
            +
              s.version = "0.0.38"
         | 
| 9 9 |  | 
| 10 10 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 11 | 
             
              s.authors = ["mcrmfc"]
         | 
| 12 | 
            -
              s.date = %q{2011-08- | 
| 12 | 
            +
              s.date = %q{2011-08-26}
         | 
| 13 13 | 
             
              s.description = %q{gem to aid setup of Capybara for testing bbc sites}
         | 
| 14 14 | 
             
              s.email = %q{mcrobbins@gmail.com}
         | 
| 15 15 | 
             
              s.extra_rdoc_files = [
         | 
| @@ -31,4 +31,55 @@ class Capybara::Driver::Mechanize | |
| 31 31 | 
             
                  @last_request_remote = true
         | 
| 32 32 | 
             
                end
         | 
| 33 33 | 
             
              end
         | 
| 34 | 
            +
              
         | 
| 35 | 
            +
              def cookies
         | 
| 36 | 
            +
                cookies = []
         | 
| 37 | 
            +
                
         | 
| 38 | 
            +
                agent.cookie_jar.jar.each do |domain|
         | 
| 39 | 
            +
                  domain[1].each do |path|
         | 
| 40 | 
            +
                    path[1].each do |cookie|
         | 
| 41 | 
            +
                      cookies.push({
         | 
| 42 | 
            +
                        :name => cookie[1].name,
         | 
| 43 | 
            +
                        :value => cookie[1].value,
         | 
| 44 | 
            +
                        :domain => cookie[1].domain,
         | 
| 45 | 
            +
                        :secure => cookie[1].secure,
         | 
| 46 | 
            +
                        :expires => cookie[1].expires,
         | 
| 47 | 
            +
                        :path => cookie[1].path
         | 
| 48 | 
            +
                      })
         | 
| 49 | 
            +
                    end
         | 
| 50 | 
            +
                  end
         | 
| 51 | 
            +
                end
         | 
| 52 | 
            +
                cookies
         | 
| 53 | 
            +
              end
         | 
| 54 | 
            +
              
         | 
| 55 | 
            +
              def cookie_named(name)
         | 
| 56 | 
            +
                cookies.find { |c| c[:name] == name }
         | 
| 57 | 
            +
              end
         | 
| 58 | 
            +
              
         | 
| 59 | 
            +
              def delete_cookie(cookie_name)
         | 
| 60 | 
            +
                agent.cookie_jar.jar.each do |domain|
         | 
| 61 | 
            +
                  domain[1].each do |path|
         | 
| 62 | 
            +
                    path[1].each do |cookie|
         | 
| 63 | 
            +
                      if cookie[0] == cookie_name
         | 
| 64 | 
            +
                        agent.cookie_jar.jar[domain[0]][path[0]].delete(cookie[0])
         | 
| 65 | 
            +
                      end
         | 
| 66 | 
            +
                    end
         | 
| 67 | 
            +
                  end
         | 
| 68 | 
            +
                end
         | 
| 69 | 
            +
              end
         | 
| 70 | 
            +
              
         | 
| 71 | 
            +
              def delete_all_cookies
         | 
| 72 | 
            +
                agent.cookie_jar.clear!
         | 
| 73 | 
            +
              end
         | 
| 74 | 
            +
              
         | 
| 75 | 
            +
             FakeURI = Struct.new(:host)
         | 
| 76 | 
            +
             def add_cookie(attribs)
         | 
| 77 | 
            +
                c = Mechanize::Cookie.new(attribs[:name],attribs[:value])
         | 
| 78 | 
            +
                # remember: mechanize always removes leading '.' from domains
         | 
| 79 | 
            +
                c.domain = attribs[:domain].sub!(/^./, '')
         | 
| 80 | 
            +
                c.path = '/'
         | 
| 81 | 
            +
                c.expires = attribs[:expires]
         | 
| 82 | 
            +
                c.secure = attribs[:secure]
         | 
| 83 | 
            +
                agent.cookie_jar.add(FakeURI.new(c.domain),c)
         | 
| 84 | 
            +
              end
         | 
| 34 85 | 
             
            end
         | 
| @@ -21,3 +21,61 @@ class Capybara::Driver::Node | |
| 21 21 | 
             
              end
         | 
| 22 22 | 
             
            end
         | 
| 23 23 |  | 
| 24 | 
            +
            class Capybara::Driver::Selenium
         | 
| 25 | 
            +
              def cookies
         | 
| 26 | 
            +
                browser.manage.all_cookies
         | 
| 27 | 
            +
              end
         | 
| 28 | 
            +
              
         | 
| 29 | 
            +
              def cookie_named(name)
         | 
| 30 | 
            +
                browser.manage.cookie_named(name)
         | 
| 31 | 
            +
              end
         | 
| 32 | 
            +
              
         | 
| 33 | 
            +
              def delete_cookie(cookie)
         | 
| 34 | 
            +
                browser.manage.delete_cookie(cookie)
         | 
| 35 | 
            +
              end
         | 
| 36 | 
            +
              
         | 
| 37 | 
            +
              def delete_all_cookies
         | 
| 38 | 
            +
                browser.manage.delete_all_cookies
         | 
| 39 | 
            +
              end
         | 
| 40 | 
            +
              
         | 
| 41 | 
            +
              def add_cookie(attribs)
         | 
| 42 | 
            +
                browser.manage.add_cookie(attribs)
         | 
| 43 | 
            +
              end
         | 
| 44 | 
            +
            end
         | 
| 45 | 
            +
             | 
| 46 | 
            +
            module Capybara
         | 
| 47 | 
            +
              class Session
         | 
| 48 | 
            +
                ##
         | 
| 49 | 
            +
                # Get all cookies
         | 
| 50 | 
            +
                #
         | 
| 51 | 
            +
                # @return [Array<Hash>] list of cookies
         | 
| 52 | 
            +
                #
         | 
| 53 | 
            +
                def cookies    
         | 
| 54 | 
            +
                  driver.cookies
         | 
| 55 | 
            +
                end
         | 
| 56 | 
            +
             | 
| 57 | 
            +
                ##
         | 
| 58 | 
            +
                # Get the cookie with the given name
         | 
| 59 | 
            +
                #
         | 
| 60 | 
            +
                # @param [String] name the name of the cookie
         | 
| 61 | 
            +
                # @return [Hash, nil] the cookie, or nil if it wasn't found.
         | 
| 62 | 
            +
                #
         | 
| 63 | 
            +
                def cookie_named(name)    
         | 
| 64 | 
            +
                  driver.cookie_named(name)
         | 
| 65 | 
            +
                end
         | 
| 66 | 
            +
                
         | 
| 67 | 
            +
                def delete_cookie(cookie)
         | 
| 68 | 
            +
                  driver.delete_cookie(cookie)
         | 
| 69 | 
            +
                end
         | 
| 70 | 
            +
                
         | 
| 71 | 
            +
                def delete_all_cookies
         | 
| 72 | 
            +
                  driver.delete_all_cookies
         | 
| 73 | 
            +
                end
         | 
| 74 | 
            +
                
         | 
| 75 | 
            +
                def add_cookie(attribs)
         | 
| 76 | 
            +
                  driver.add_cookie(attribs)
         | 
| 77 | 
            +
                end
         | 
| 78 | 
            +
              end
         | 
| 79 | 
            +
            end
         | 
| 80 | 
            +
             | 
| 81 | 
            +
             | 
    
        metadata
    CHANGED
    
    | @@ -1,13 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: frameworks-capybara
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              hash:  | 
| 4 | 
            +
              hash: 83
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 7 | 
             
              - 0
         | 
| 8 8 | 
             
              - 0
         | 
| 9 | 
            -
              -  | 
| 10 | 
            -
              version: 0.0. | 
| 9 | 
            +
              - 38
         | 
| 10 | 
            +
              version: 0.0.38
         | 
| 11 11 | 
             
            platform: ruby
         | 
| 12 12 | 
             
            authors: 
         | 
| 13 13 | 
             
            - mcrmfc
         | 
| @@ -15,7 +15,7 @@ autorequire: | |
| 15 15 | 
             
            bindir: bin
         | 
| 16 16 | 
             
            cert_chain: []
         | 
| 17 17 |  | 
| 18 | 
            -
            date: 2011-08- | 
| 18 | 
            +
            date: 2011-08-26 00:00:00 +01:00
         | 
| 19 19 | 
             
            default_executable: 
         | 
| 20 20 | 
             
            dependencies: 
         | 
| 21 21 | 
             
            - !ruby/object:Gem::Dependency 
         |