Sha256: 09b80d6eb2db5d72bd175d2733b89ea3582d02a4a316d648d2ba0f39c42c685b
Contents?: true
Size: 966 Bytes
Versions: 9
Compression:
Stored size: 966 Bytes
Contents
require 'spec_helper' describe BitBucket::Validations::Format do let(:format) { Class.new.extend(described_class) } before do @permitted = {"param1" => ["val1", "val2"], "param2" => /^regexp$/} end describe ".assert_valid_values" do it "raises an UnknownValue error when provided an unpermitted parameter" do params = {"param1" => "unpermitted_value"} expect{ format.assert_valid_values(@permitted, params) }.to raise_error BitBucket::Error::UnknownValue params = {"param2" => "unpermitted_value"} expect{ format.assert_valid_values(@permitted, params) }.to raise_error BitBucket::Error::UnknownValue end it "returns the params when provided with only permitted parameters" do params = {"param1" => "val1", "param2" => "regexp"} expect( format.assert_valid_values(@permitted, params) ).to eq({"param1" => "val1", "param2" => "regexp"}) end end end
Version data entries
9 entries across 9 versions & 2 rubygems