Some tests for users controller, and fixed users#index
This commit is contained in:
parent
adfa9cc871
commit
4955481f14
9 changed files with 84 additions and 10 deletions
23
spec/support/database_cleaner.rb
Normal file
23
spec/support/database_cleaner.rb
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
RSpec.configure do |config|
|
||||
|
||||
config.before(:suite) do
|
||||
DatabaseCleaner.clean_with(:truncation)
|
||||
end
|
||||
|
||||
config.before(:each) do
|
||||
DatabaseCleaner.strategy = :transaction
|
||||
end
|
||||
|
||||
config.before(:each, :js => true) do
|
||||
DatabaseCleaner.strategy = :truncation
|
||||
end
|
||||
|
||||
config.before(:each) do
|
||||
DatabaseCleaner.start
|
||||
end
|
||||
|
||||
config.after(:each) do
|
||||
DatabaseCleaner.clean
|
||||
end
|
||||
|
||||
end
|
||||
10
spec/support/sigin_macros.rb
Normal file
10
spec/support/sigin_macros.rb
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
module SigninMacros
|
||||
def sign_in(user)
|
||||
visit new_user_session_path
|
||||
fill_in 'user_email', with:'user.email'
|
||||
fill_in 'user_password', with: 'user.password'
|
||||
click_button 'Sign in'
|
||||
page.should have_content('Signed in successfully')
|
||||
end
|
||||
end
|
||||
0
spec/support/signin_macros.rb
Normal file
0
spec/support/signin_macros.rb
Normal file
Loading…
Add table
Add a link
Reference in a new issue