rspec - Integration testing with Capybara -
i'm trying integration test of app covered funcionalities. app uploads file , leads page message 'your database has been updated¡¡'. user can't see when uploads excel file updates database. well, i've used capybara rspec able test upload excel file. test pass green don't understand why, cause i've written false message check test works propperly , still passes... i'm newby need please
spec/app_integration_spec.rb
require file.join(file.dirname(__file__), '..', 'app.rb') require 'capybara' require 'capybara/rspec' capybara.app = lamareta describe "updating vip customers database", :type => :feature before { datamapper.setup(:default, 'postgres://david:123456@localhost/usersmareta') datamapper.finalize.auto_upgrade! } after { clients_database = vipclient.all clients_database.each { |client| client.destroy } } "uploads succesfully excel file vip customers data birhtday" visit '/' attach_file('birthdayfile', 'spec/fixtures/databasetest.xlsx') click_button 'upload_excel' expect(page).to have_content 'hola' end end
upload.rb
<h1>my file uploader!!</h1> <form action="/upload" method="post" enctype='multipart/form-data'> <input type='file' name='birthdayfile' accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"> <input type='submit' value='upload!' id="upload_excel"> </form>
uploaded_file.rb
<h1>your database has been updated¡¡</h1>
edit question
spec/spec_helper.rb
rspec.configure |config| config.expect_with :rspec |expectations| expectations.include_chain_clauses_in_custom_matcher_descriptions = true end config.mock_with :rspec |mocks| mocks.verify_partial_doubles = true end end
Comments
Post a Comment