summaryrefslogtreecommitdiff
path: root/spec/models/user_spec.rb
blob: 1117f00f7d42dd4f6fe70ba8ae76842bd9c32b55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
require "spec_helper"

describe User do
  describe "#apply_for_license" do
    context "when applying for a license" do
      let(:company) { Company.create(name: 'ABC Resources Ltd.') }
      let(:user) { User.create(company: company) }
      let(:location) { Location.new(latitude: 51.06, longitude: -114.09, township: '1') }

      it "creates a new license" do
        license = user.apply_for_license(WellType::NFW, location)
        license.company.should == user.company
        license.well_type.should == WellType::NFW
        license.location.should == location
        license.applicant.should == user
      end
    end
  end

  describe "#full_name" do
    it "returns the full name" do
      User.new(first_name: "mo", last_name: "khan").full_name.should == "mo khan"
    end
  end
end