Spec your widgets!
This gem allows you to test widgets with Apotomo via RSpec.
Works with Rails 3.x and RSpec 2.
In your Rails Gemfile
add this line:
group :test do
gem 'rspec-apotomo'
end
Put specs in the spec/widgets
directory.
TODO Add the generator and generator docs.
An example spec could look like the following code.
describe CommentsWidget do
has_widgets do |root|
root << widget(:comments)
end
it 'renders properly' do
render_widget(:comments).should == "<h1>No Comment!</h1>"
end
it 'responds to :post events' do
trigger(:post, :comments, :text => "I like you!").should == ["Thanks!"]
end
end
Run your examples with:
rake spec:widgets
Copyright © 2011 Vivisimo, Inc., Christian Höltje, Jake Goulding, Nick Sutterer
Released under the MIT License