Rspec On Rails Matchers plugin
Plugin details
Documentation
Install the plugin:
ruby script/plugin install http://rspec-on-rails-matchers.googlecode.com/svn/trunk/
In your view spec:
it "should render new form" do render "/users/new.html.erb" response.should have_form_posting_to(users_path) do with_text_field_for(:user_name) with_text_area_for(:user_address) with_text_field_for(:user_login) with_text_field_for(:user_email) with_submit_button end end
In your model spec:
describe User do before(:each) do @user = User.new end it "should have many posts" do @user.should have_many(:posts) end it "should belong to a group" do @user.should belong_to(:group) end it do @user.should validate_presence_of(:email) end it do @user.should validate_uniqueness_of(:email) end it do @user.should validate_uniqueness_of(:login) end it do @user.should validate_presence_of(:login) end it do @user.should validate_presence_of(:name) end it do @user.should validate_length_of(:password, :between => 4..40) end it do @user.should validate_confirmation_of(:password) end end
Further Documentation
There is currently no advanced documentation for this plugin.
New documentationEdit plugin | (0 older versions) | Last edited by: Guest, 10 months ago

