Sha256: 3025d8b1c251ddf841d4130716ce4c7223231434d0777be2ed9b58348087ae97

Contents?: true

Size: 1.67 KB

Versions: 1

Compression:

Stored size: 1.67 KB

Contents

= Rspec Cells

<em>Spec your Cells.</em>

This plugin allows you to test your cells easily using RSpec. Basically, it adds a cells example group with a <tt>#render_cell</tt> helper.

Cells is Rails' popular {view components framework}[http://github.com/apotonick/cells].

= Installation

This gem runs with RSpec2 and Rails 3.0, so just add it to your app's +Gemfile+.

  group :test do
    gem "rspec-cells"


= Usage

Simply put all your specs in the <tt>spec/cells</tt> directory. However, let the cell generator do that for you!
  
  rails g cell blog_post show -t rspec

will create an exemplary <tt>spec/cells/blog_post_cell_spec.rb</tt> for you.

== Webrat

Webrat matchers just work as you might have expected - here is how a simple spec could look like.

  describe PostsCell do
    it "should render the posts count" do
      render_cell(:posts, :count).should have_selector("p", :content => "4 posts!")
    end
  end

== Capybara

If you want Capybara's string matchers be sure to bundle at least capybara +0.4.1+ in your Gemfile.

  gem "capybara", "~> 0.4.1"

You can then use capybara's matchers in your cell spec.

 describe PostsCell do
    it "should render the posts count" do
      render_cell(:posts, :box).should have_css("div#widget h3")
    end
  end

  
== Running the specs

Run your examples with

  rake spec:cells

If you need more helpers, matchers and stuff, {just let us know}[http://cells.rubyforge.org/community.html].

== Contributors

* Jorge Calás Lozano <calas@qvitta.net> (Cleanup, capybara string matchers)

== LICENSE

Copyright (c) 2010, Nick Sutterer

Copyright (c) 2007-2009, Dmytro Shteflyuk <kpumuk@kpumuk.info> http://kpumuk.info

Released under the MIT License.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec-cells-0.0.4 README.rdoc