This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("Fog", function() { | |
var fog; | |
beforeEach(function() { | |
fog = new Fog(); | |
}); | |
it("should create Fog with default parameters", function() { | |
expect(fog.settings.zMinMax).toEqual([ 0, 100 ]); | |
expect(fog.settings.intensity).toEqual(1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EditStatusConstraint | |
def self.matches?(request) | |
request.params['update_action'] == 'edit_status' | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
patch 'calculations/:id' => 'calculations/edit_status#create', constraints: EditStatusConstraint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= simple_form_for @calculation do |f| | |
.row | |
= f.input :status | |
= hidden_field_tag 'update_action', 'edit_status' | |
= f.submit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= simple_form_for @calculation do |f| | |
.row | |
= f.input :status | |
= hidden_field_tag 'update_action', 'change_insured_count' | |
= f.submit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
base.delegate :province_name, to: 'address.zip_code', allow_nil: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EmailValidator < ActiveModel::EachValidator | |
require 'resolv' | |
def validate_each(record, attribute, value) | |
unless value =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i | |
record.errors[attribute] << (options[:message] || I18n.t('email.wrong')) | |
end | |
split_email = value.split("@") | |
domain = split_email[1].to_s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
search_result: { | |
['09:00', '10:59']: ['xxx', 'zzz', 'yyy'], | |
['11:00', '12:59']: ['kkk', 'lll', 'mmm'] | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FactoryGirl.define do | |
factory :client_person do | |
first_name "Joe" | |
sequence(:last_name) { |n| "Doe#{n}" } | |
pesel { Rpg::Pesel.new(gender: :female, date: Time.at(0.0 + rand * (Time.now.to_f - 0.0.to_f)).strftime('%Y-%m-%d')).generate } | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FactoryGirl.define do | |
factory :client_person do | |
first_name "Joe" | |
sequence(:last_name) { |n| "Doe#{n}" } | |
pesel { Pesel::EXAMPLE_Pesels[ClientPerson.count] } | |
end | |
end |
NewerOlder