What Is Rspec?

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on. →

What Is Rspec?

A beginner's level introduction: what is RSpec and what makes it different from (or better than) traditional unit testing frameworks. If you've heard of RSpec but you have no idea what it is, this talk is for you.

Jon Canady

May 19, 2014

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

52 slides
  1. spec/user_spec.rb describe User do it "authenticates the correct password" do

    expect( User.authenticate(“win") ).to eq(true) end end
  2. spec/user_spec.rb describe User do it "authenticates the correct password" do

    expect( User.authenticate(“win") ).to eq(true) end end
  3. spec/user_spec.rb describe User do it "authenticates the correct password" do

    expect( User.authenticate(“win") ).to eq(true) end end
  4. spec/user_spec.rb describe User do it "authenticates the correct password" do

    expect( User.authenticate("win") ).to eq(true) end end
  5. spec/user_spec.rb describe User do it "authenticates the correct password" do

    expect( User.authenticate("win") ).to eq(true) end end
  6. spec/user_spec.rb describe User do it "authenticates the correct password" do

    expect( User.authenticate("win") ).to eq(true) end end
  7. spec/user_spec.rb ! ).to eq(true) end ! it "rejects an incorrect

    password" do expect( User.authenticate("lose") ).to eq(false) end end
  8. spec/user_spec.rb ! ).to eq(true) end ! it "rejects an incorrect

    password" do expect( User.authenticate("lose") ).to eq(false) end end
  9. spec/user_spec.rb ! ).to eq(true) end ! it "rejects an incorrect

    password" do expect( described_class.authenticate("lose") ).to eq(false) end end
  10. expect( described_class.authenticate("lose") ).to eq(false) end ! ! spec/user_spec.rb it "is

    not an administrator by default" do expect( User.new.admin? ).to eq(false) end end
  11. expect( described_class.authenticate("lose") ).to eq(false) end ! ! spec/user_spec.rb it "is

    not an administrator by default" do expect( User.new.admin? ).to eq(false) end end
  12. expect( described_class.authenticate("lose") ).to eq(false) end ! ! spec/user_spec.rb it "is

    not an administrator by default" do expect( subject.admin? ).to eq(false) end end
  13. describe User do context "when representing an admin" do it

    "flags the user as an admin" do expect( User.new(admin: true).admin? ).to eq(true) end it "lets the user delete posts" do spec/user_spec.rb
  14. describe User do context "when representing an admin" do it

    "flags the user as an admin" do expect( User.new(admin: true).admin? ).to eq(true) end it "lets the user delete posts" do spec/user_spec.rb
  15. describe User do context "when representing an admin" do it

    "flags the user as an admin" do expect( User.new(admin: true).admin? ).to eq(true) end it "lets the user delete posts" do spec/user_spec.rb
  16. describe User do context "when representing an admin" do subject

    do User.new(admin: true) end ! it "flags the user as an admin" do expect( User.new(admin: true).admin? ).to eq(true) spec/user_spec.rb
  17. describe User do context "when representing an admin" do subject

    do User.new(admin: true) end ! it "flags the user as an admin" do expect( User.new(admin: true).admin? ).to eq(true) spec/user_spec.rb
  18. describe User do context "when representing an admin" do subject

    do described_class.new(admin: true) end ! it "flags the user as an admin" do expect( User.new(admin: true).admin? ).to eq(true) spec/user_spec.rb
  19. describe User do context "when representing an admin" do subject

    do described_class.new(admin: true) end ! it "flags the user as an admin" do expect( subject.admin? ).to eq(true) spec/user_spec.rb

More Decks by Jon Canady

Other Decks in Programming