Skip to content

Instantly share code, notes, and snippets.

@nandokakimoto

nandokakimoto/plan_spec.rb Secret

Last active Feb 1, 2017
Embed
What would you like to do?
blog-post-830-test-fix-validation-error
require 'rails_helper'
RSpec.describe Plan, type: :model do
describe ".price" do
let(:plan) { Plan.create(name: 'basic') }
describe "has less than 2 members" do
(...)
end
describe "has more than two members" do
let(:joe) { Member.create(first_name: 'Joe', last_name: 'Montana') }
let(:mary) { Member.create(first_name: 'Mary', last_name: 'Jana') }
let(:sarah) { Member.create(first_name: 'Sarah', last_name: 'Anderson') }
it "should give 1 discount per additional user" do
plan.members << joe
plan.members << mary
plan.members << sarah
expect(plan.price).to eql(19)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment