test-page 0.0.2 → 0.0.3

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.
@@ -0,0 +1 @@
1
+ repo_token: DTKokhL9P3koXfPLu8BRED4PdWPc5kFQg
@@ -2,3 +2,11 @@ rvm:
2
2
  - 1.8.7
3
3
  - 1.9.2
4
4
  - 1.9.3
5
+ - ruby-head
6
+ notifications:
7
+ recipients:
8
+ - jarmo.p@gmail.com
9
+ matrix:
10
+ allow_failures:
11
+ - rvm: ruby-head
12
+
data/Gemfile CHANGED
@@ -1,3 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+ gem 'coveralls', :require => false
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Test::Page
2
2
 
3
3
  [![Build Status](https://secure.travis-ci.org/jarmo/test-page.png)](http://travis-ci.org/jarmo/test-page)
4
+ [![Coverage](https://coveralls.io/repos/jarmo/test-page/badge.png?branch=master)](https://coveralls.io/r/jarmo/test-page)
4
5
  [![Dependency Status](https://gemnasium.com/jarmo/test-page.png)](https://gemnasium.com/jarmo/test-page)
5
6
  [![Code Quality](https://codeclimate.com/badge.png)](https://codeclimate.com/github/jarmo/test-page)
6
7
 
@@ -136,13 +136,14 @@ module Test
136
136
  # Subsequent executions of the same method will be invoked on the {Page} object directly.
137
137
  def method_missing(name, *args)
138
138
  begin
139
- el = element
139
+ element
140
140
  rescue SystemStackError
141
141
  raise_invalid_element_definition
142
142
  end
143
- if el.respond_to?(name)
143
+
144
+ if element.respond_to?(name)
144
145
  self.class.send :define_method, name do |*args|
145
- el.send(name, *args) {yield}
146
+ element.send(name, *args) {yield}
146
147
  end
147
148
  self.send(name, *args) {yield}
148
149
  else
@@ -1,5 +1,5 @@
1
1
  module Test
2
2
  class Page
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -1,2 +1,5 @@
1
1
  require "simplecov"
2
+ require 'coveralls'
3
+
4
+ SimpleCov.formatter = Coveralls::SimpleCov::Formatter
2
5
  SimpleCov.start
@@ -178,6 +178,21 @@ describe Test::Page do
178
178
  page.should respond_to(:size)
179
179
  end
180
180
 
181
+ it "defined methods to the page class will invoke methods on new element instance too" do
182
+ page = page_class.new "element"
183
+ page.size
184
+ el = page.element
185
+ el.instance_eval do
186
+ singleton = class << self; self end
187
+ singleton.send(:define_method, :size) { raise "not expected to call this!" }
188
+ end
189
+
190
+ page.instance_variable_set :@element, "new element"
191
+ expect {
192
+ page.size
193
+ }.not_to raise_error
194
+ end
195
+
181
196
  it "will raise a NoMethodError if no method is found on element" do
182
197
  expect { page_class.new("element").foo }.to raise_error(NoMethodError)
183
198
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test-page
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-03 00:00:00.000000000 Z
12
+ date: 2013-01-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -99,6 +99,7 @@ executables: []
99
99
  extensions: []
100
100
  extra_rdoc_files: []
101
101
  files:
102
+ - .coveralls.yml
102
103
  - .gitignore
103
104
  - .rspec
104
105
  - .travis.yml