Slide 1

Slide 1 text

Ember + Rails + Capybara = ❤ Robert Schäfer @roschaefer

Slide 2

Slide 2 text

EmberJS Rails Acceptance *against Mirage Requests, API Capybara Full Stack Controllers Integration Components Unit Controllers, Helpers, Models, Routes Models, Mailers, Routing

Slide 3

Slide 3 text

Specification by example

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

My favourite vegetable ★ executable documentation ★ always up-to-date ★ natural language

Slide 6

Slide 6 text

User story template @42 Feature: As a I want to In order to

Slide 7

Slide 7 text

Feature: Full stack testing with Ember and Rails As a developer who gives a talk I want to show a secret to registered users only In order to give a valid use case for full stack testing Background: Given the backend knows the answer And only registered users have access to it Scenario: Given I am logged in When I visit the landing page Then I can see a message: """ The answer is 42 """

Slide 8

Slide 8 text

Set up Capybara features/support/env.rb 1. Start Ember and Rails servers 2. Load the Rails environment 3. Tell capybara to watch localhost:4200 4. Rock’n Roll!

Slide 9

Slide 9 text

Live Demo #1

Slide 10

Slide 10 text

Sometimes difficult to set up and maintain

Slide 11

Slide 11 text

External requests

Slide 12

Slide 12 text

Frontend Backend 1. Authentication 2. Encrypted JW T Token 3. Request (JWT in header) 5. Authorized response 4. Decrypt JWT token

Slide 13

Slide 13 text

Live Demo #2

Slide 14

Slide 14 text

EmberJS Rails Acceptance *against Mirage Requests, API Capybara Full Stack Controllers Integration Components Unit Controllers, Helpers, Models, Routes Models, Mailers, Routing

Slide 15

Slide 15 text

Truth EmberJS 3:30 min total Rails 2:42 min total Acceptance 0 ember-only acceptance tests 62 examples 16 seconds 48 scenarios, 280 steps 4:30 min (+ 6 min setup) Full Stack 11 examples 1 second Integration 72 assertions 2 seconds Unit 142 assertions 2 seconds 69 examples 1 second

Slide 16

Slide 16 text

Questions? roschaefer/rundfunk-mitbestimmen

Slide 17

Slide 17 text

Rundfunk MITBESTIMMEN

Slide 18

Slide 18 text

broadcasting fees every year 8,000,000,000 €

Slide 19

Slide 19 text

source: mdr.de

Slide 20

Slide 20 text

Why do I have to pay and don’t get a say?

Slide 21

Slide 21 text

Show your appreciation (=fees) for broadcasts through a web-app - and provide the data for a better TV/Radio rating

Slide 22

Slide 22 text

“What you do is politically explosive” - Heiko Hilker, member of MDR broadcasting board since 1997

Slide 23

Slide 23 text

rundfunk-mitbestimmen.de Thanks