domino 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/domino.rb +7 -15
  2. metadata +37 -77
data/lib/domino.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'capybara/dsl'
2
- require 'nokogiri'
3
2
  # To create a basic Domino class, inherit from Domino and
4
3
  # define a selector and attributes:
5
4
  #
@@ -36,7 +35,7 @@ class Domino
36
35
  # Namespaced Domino::Error
37
36
  class Error < StandardError ; end
38
37
 
39
- # Direct access to the nokogiri node, in case you need
38
+ # Direct access to the capybara node, in case you need
40
39
  # anything special
41
40
  attr_reader :node
42
41
 
@@ -96,17 +95,12 @@ class Domino
96
95
 
97
96
  private
98
97
 
99
- # Return the html of the current page
100
- def page_body
101
- Capybara.current_session.body
102
- end
103
-
104
- # Return nokogiri nodes for this object
98
+ # Return capybara nodes for this object
105
99
  def nodes
106
100
  if @selector.nil?
107
101
  raise Domino::Error.new("You must define a selector")
108
102
  end
109
- Nokogiri::HTML(page_body).css(@selector)
103
+ Capybara.current_session.all(@selector)
110
104
  end
111
105
 
112
106
  # Internal method for finding nodes by a selector
@@ -124,11 +118,9 @@ class Domino
124
118
  #
125
119
  # Dom::Post.all.first.attribute('.title')
126
120
  def attribute(selector)
127
- if @node.css(selector).size > 0
128
- @node.css(selector).first.text.strip
129
- else
130
- nil
131
- end
121
+ @node.find(selector).text
122
+ rescue Capybara::ElementNotFound
123
+ nil
132
124
  end
133
125
 
134
126
  # Dom id for this object.
@@ -137,7 +129,7 @@ class Domino
137
129
  end
138
130
 
139
131
  private
140
- # Takes a Nokogiri node and sets attributes
132
+ # Store the capybara node internally
141
133
  def initialize(node)
142
134
  @node = node
143
135
  end
metadata CHANGED
@@ -1,114 +1,74 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: domino
3
- version: !ruby/object:Gem::Version
4
- hash: 27
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 0
10
- version: 0.1.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Nick Gauthier
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-03-04 00:00:00 -05:00
12
+ date: 2011-03-15 00:00:00.000000000 -04:00
19
13
  default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
22
16
  name: capybara
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: &13615420 !ruby/object:Gem::Requirement
25
18
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 15
30
- segments:
31
- - 0
32
- - 4
33
- - 0
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
34
22
  version: 0.4.0
35
23
  type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: nokogiri
39
24
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- hash: 7
46
- segments:
47
- - 1
48
- - 4
49
- - 0
50
- version: 1.4.0
51
- type: :runtime
52
- version_requirements: *id002
53
- - !ruby/object:Gem::Dependency
25
+ version_requirements: *13615420
26
+ - !ruby/object:Gem::Dependency
54
27
  name: minitest
55
- prerelease: false
56
- requirement: &id003 !ruby/object:Gem::Requirement
28
+ requirement: &13614820 !ruby/object:Gem::Requirement
57
29
  none: false
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- hash: 3
62
- segments:
63
- - 0
64
- version: "0"
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
65
34
  type: :development
66
- version_requirements: *id003
67
- description: "\n Make it easier to deal with UI elements by providing an\n interface that decouples your tests from your views.\n "
35
+ prerelease: false
36
+ version_requirements: *13614820
37
+ description: ! "\n Make it easier to deal with UI elements by providing an\n interface
38
+ that decouples your tests from your views.\n "
68
39
  email: ngauthier@gmail.com
69
40
  executables: []
70
-
71
41
  extensions: []
72
-
73
- extra_rdoc_files:
42
+ extra_rdoc_files:
74
43
  - README.md
75
- files:
44
+ files:
76
45
  - lib/domino.rb
77
46
  - MIT-LICENSE
78
47
  - README.md
79
48
  has_rdoc: true
80
49
  homepage: http://www.github.com/ngauthier/domino
81
- licenses:
50
+ licenses:
82
51
  - MIT
83
52
  post_install_message:
84
53
  rdoc_options: []
85
-
86
- require_paths:
54
+ require_paths:
87
55
  - lib
88
- required_ruby_version: !ruby/object:Gem::Requirement
56
+ required_ruby_version: !ruby/object:Gem::Requirement
89
57
  none: false
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- hash: 3
94
- segments:
95
- - 0
96
- version: "0"
97
- required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
63
  none: false
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- hash: 3
103
- segments:
104
- - 0
105
- version: "0"
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
106
68
  requirements: []
107
-
108
69
  rubyforge_project:
109
- rubygems_version: 1.4.2
70
+ rubygems_version: 1.5.2
110
71
  signing_key:
111
72
  specification_version: 3
112
73
  summary: View abstraction for integration testing
113
74
  test_files: []
114
-