How do you compare date/times in RSpec?
If you do this
expect(Time.now.to_i).to eq Time.new(2014, 4, 2).to_i| /** | |
| * Generate a random alphanumeric password | |
| * precondition: len must be <= 32 | |
| * param len: length of the random password | |
| * param enforce_rules: enforce password security rules | |
| * returns: the random password | |
| **/ | |
| public static function generateRandomPassword($len=8, $enforce_rules = false) | |
| { | |
| $count = 0; |
| helper_method :get_completion | |
| def get_completion(user) | |
| if user.name | |
| done = {} | |
| comp = JSON.parse(user.completion) | |
| if comp.length > 0 | |
| comp.each do |catkey,catval| | |
| if catkey | |
| done[catkey] = {} | |
| if catval |
This list is based on aliases_spec.rb.
You can see also Module: RSpec::Matchers API.
| matcher | aliased to | description |
|---|---|---|
| a_truthy_value | be_truthy | a truthy value |
| a_falsey_value | be_falsey | a falsey value |
| be_falsy | be_falsey | be falsy |
| a_falsy_value | be_falsey | a falsy value |
| =Navigating= | |
| visit('/projects') | |
| visit(post_comments_path(post)) | |
| =Clicking links and buttons= | |
| click_link('id-of-link') | |
| click_link('Link Text') | |
| click_button('Save') | |
| click('Link Text') # Click either a link or a button | |
| click('Button Value') |