Integrating Angular.js with Rails (Wicked Good Ruby Conf lightening talk)
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
-
Upload
nascenia-it -
Category
Software
-
view
128 -
download
0
Transcript of Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Secrets of Testing Rails 5 Apps
Rails Tests
Unit tests -> For models
Functional tests -> For controllers
Integration tests -> For scenarios of a particular feature
Change in rails 5
Unit tests -> No big change
Controller tests -> are most affected
What do we test in a controller test ?
Request --------------> Response
Controller tests actually lie...
Integration tests
Integration tests
Almost same as controller tests
Close to the real world
But before rails 5 they were really slow
Integration Controller tests are default in Rails 5
Functional Controller tests are soft deprecated
Old functional tests will continue to work for now***
Might be extracted in separate gem in Rails 5.1
BLACK BOX
Sprockets
Sprockets
Speeding Up Your Test Suite
Returns a saved User instance (writes to DB)
user = create(:user)
# Returns a User instance that's not saved (does not write to DB)
user = build(:user)
factory :user do
association posts
end
FactoryGirl.build(:user) #this creates posts in the database even though you are only building the parent object(user)
Returns an object with all defined attributes stubbed out
stub = build_stubbed(:user)
20 Tools and Techniques That Make You More Creative
Thank You