-
Notifications
You must be signed in to change notification settings - Fork 0
Setting up Alfred
Arjen Oosterkamp edited this page Apr 8, 2014
·
1 revision
This page describes setting up Alfred.
- Add
gem 'alfred_rails'to your Gemfile. - Run
bundle install.
If you need to stub anything, or you use Devise/FactoryGirl you can include their helpers.
# spec/alfred_helper.rb
Alfred.configure do |config|
## Includes
config.include FactoryGirl::Syntax::Methods
config.include Devise::TestHelpers
## Setup
config.setup do
Apartment::Database.stub(:create).and_return(true)
end
## Mocking framework
config.mock_with :rspec
## Fixture path
config.fixture_path 'spec/javascripts/fixtures'
end# spec/alfreds/api/v1/posts_controller.rb
Alfred.define do
setup do
sign_in :user, create(:user)
end
controller Api::V1::PostsController do
scenario 'update post by manager' do
setup do
create(:post, :title => 'Alfred is awesome', :body => 'It saves me time')
end
patch :update, {
:format => :json,
:id => 1,
:post => {
:title => 'Alfred rocks!'
}
}
end
end
endRun alfred in your console. This generates all fixtures.