Skip to content

Commit

Permalink
updated README and created gem
Browse files Browse the repository at this point in the history
  • Loading branch information
despo committed Feb 10, 2012
1 parent 4ce81e4 commit cc2beeb
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 7 deletions.
6 changes: 1 addition & 5 deletions Gemfile
@@ -1,7 +1,3 @@
source :rubygems

group :development do
gem 'capybara'
gem 'rspec'
gem 'sinatra'
end
gemspec
11 changes: 9 additions & 2 deletions Gemfile.lock
@@ -1,3 +1,9 @@
PATH
remote: .
specs:
prickle (0.0.1)
capybara

GEM
remote: http://rubygems.org/
specs:
Expand Down Expand Up @@ -47,5 +53,6 @@ PLATFORMS

DEPENDENCIES
capybara
rspec
sinatra
prickle!
rspec (~> 2.8.0)
sinatra (~> 1.3.2)
69 changes: 69 additions & 0 deletions README.md
@@ -1 +1,70 @@
![](http://github.com/despo/prickle/raw/master/prickle.png)

## Configuration

To install prickle execute

```ruby
gem install prickle
```

and to configure

```ruby
require 'prickle/capybara'

World do
include Capybara::DSL
include Prickle::Capybara #include it after Capybara
end
```

## Usage

### Find elements by any html tag(s)

```ruby
element(:href => "http://google.com")
element(:name => "blue")
element(:id => "key")
element(:class => "key", :id => "button")
```

### Find elements by type and html tag(s)

```ruby
element(:link,:href => "http://google.com")
element(:input, :name => "blue")
``

### Apply a search, a click or a text matcher

``ruby

element(:name => "flower")*.exists?*
element(:name => "flower")*.click*
element(:name => "flower")*.contains_text? "Roses"*
```

## Alternative syntax

### Find

```ruby
find_by_name "green"

find_button_by_name "green" #find_<element_tag>_by_name "<name>"
```

## Click

```ruby
click_by_name "blue"
click_input_by_name "blue" #click_<element_tag>_by_name "<name>"
``

### Match text

```ruby
div_contains_text? "text" #<element_tag>_contains_text? "text"
```
3 changes: 3 additions & 0 deletions lib/prickle/version.rb
@@ -0,0 +1,3 @@
module Prickle
VERSION = '0.0.1'
end
28 changes: 28 additions & 0 deletions prickle.gemspec
@@ -0,0 +1,28 @@
$:.push File.expand_path("../lib", __FILE__)
require "prickle/version"

Gem::Specification.new do |s|
s.name = "prickle"
s.version = Prickle::VERSION
s.platform = Gem::Platform::RUBY
s.author = "Despo Pentara"
s.email = "despo@extractmethod.com"
s.homepage = "https://github.com/ExtractMethod/prickle"
s.summary = "A simple DSL wrapped around Capybara for matching elements using html tags."
s.description = "A simple DSL wrapped around Capybara for matching elements using html tags."
s.required_ruby_version = '>= 1.9.2'

s.licenses = ["MIT"]

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {spec}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]

s.add_dependency "capybara"

s.add_development_dependency "capybara"
s.add_development_dependency "rspec", "~> 2.8.0"
s.add_development_dependency "sinatra", "~> 1.3.2"
end

0 comments on commit cc2beeb

Please sign in to comment.