summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-02-20 20:39:45 -0700
committermo khan <mo@mokhan.ca>2014-02-20 20:39:45 -0700
commitbd442141974a110a1647b01be919bf03de407ab9 (patch)
tree05e605937fdc0a58ac423f43305047e23b6f961d /spec
parent9a094059fcb67a9f54ee73efbdecc2835a5fe0c6 (diff)
filter by license status and township
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/v1/company_licenses_controller_spec.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/spec/controllers/v1/company_licenses_controller_spec.rb b/spec/controllers/v1/company_licenses_controller_spec.rb
index fb0972a..2784a1d 100644
--- a/spec/controllers/v1/company_licenses_controller_spec.rb
+++ b/spec/controllers/v1/company_licenses_controller_spec.rb
@@ -4,20 +4,28 @@ describe V1::CompanyLicensesController do
describe :index do
let(:company) { Object.new }
let(:company_id) { SecureRandom.uuid }
- let(:active_licenses) { [] }
+ let(:active_licenses) { ["active"] }
+ let(:active_licenses_in_township) { ["active township"] }
before :each do
Company.stub(:find).with(company_id).and_return(company)
- company.stub(:active_licenses).and_return(active_licenses)
- xhr :get, :index, company_id: company_id
+ company.stub(:status).with(LicenseStatus::ACTIVE).and_return(active_licenses)
+ active_licenses.stub(:township).with("123").and_return(active_licenses_in_township)
end
it "returns the active licenses" do
+ xhr :get, :index, company_id: company_id
assigns(:active_licenses).should == active_licenses
end
it "returns a json response" do
+ xhr :get, :index, company_id: company_id
expect(-> { JSON.parse(response.body) }).not_to raise_error
end
+
+ it "returns the active licenses for a given township" do
+ xhr :get, :index, company_id: company_id, township: "123"
+ assigns(:active_licenses).should == active_licenses_in_township
+ end
end
end