Skip to content

Commit

Permalink
Updated to V1.0.3
Browse files Browse the repository at this point in the history
Added support for accessing the capybara element of a record

Signed-off-by: hajee <hajee@moretIA.com>
  • Loading branch information
hajee authored and hajee committed Sep 4, 2013
1 parent 343d75f commit a066553
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 3 deletions.
5 changes: 4 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@ Released to production

##V1.0.2
* Added the id of the record to the inspector.
* inspecting uses the Array variant of Capybara and doesn't wait.
* inspecting uses the Array variant of Capybara and doesn't wait.

##V1.0.3
* Added support for getting the Capybara element of a record.ait.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
page_record (1.0.2)
page_record (1.0.3)
activemodel
activesupport
capybara (~> 2.1.0)
Expand Down
15 changes: 15 additions & 0 deletions lib/page_record/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@ def initialize(id = nil, selector = nil, filter = nil)
find_record(selector, filter)
end

##
# Return the Capybara element containg the record
#
# Example:
#
# ```ruby
# team_1 = TeamPage.find(1) # Get the first team
# team_1.element? # access the Capybara context
# end
# ```
#
def element?
@record
end

##
# Set's the default selector for this class
#
Expand Down
2 changes: 1 addition & 1 deletion lib/page_record/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module PageRecord
VERSION = '1.0.2'
VERSION = '1.0.3'
end
17 changes: 17 additions & 0 deletions spec/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,23 @@ class FunnyRecord < PageRecord::Base

end

describe "record.element?" do

subject { TeamPage.find().element? }

context "record on the page" do
before do
visit '/page-one-record'
end

it "returns the capybara element containing the record" do
expect(subject.class).to eq Capybara::Node::Element
end

end
end


describe "found bugs" do

describe "class name contains word page but doens't exist" do
Expand Down

0 comments on commit a066553

Please sign in to comment.