Module: Nonnative::Cucumber::Assertions
- Included in:
- Registration
- Defined in:
- lib/nonnative/cucumber.rb
Instance Method Summary collapse
- #install_assertion_steps ⇒ Object
- #install_error_assertion_steps ⇒ Object
- #install_log_assertion_steps ⇒ Object
- #install_memory_assertion_step ⇒ Object
Instance Method Details
#install_assertion_steps ⇒ Object
136 137 138 139 140 |
# File 'lib/nonnative/cucumber.rb', line 136 def install_assertion_steps install_memory_assertion_step install_error_assertion_steps install_log_assertion_steps end |
#install_error_assertion_steps ⇒ Object
153 154 155 156 157 158 159 160 161 |
# File 'lib/nonnative/cucumber.rb', line 153 def install_error_assertion_steps Then('starting the system should raise an error') do expect(@start_error).to be_a(Nonnative::StartError) end Then('stopping the system should raise an error') do expect(@stop_error).to be_a(Nonnative::StopError) end end |
#install_log_assertion_steps ⇒ Object
163 164 165 166 167 168 169 170 171 172 |
# File 'lib/nonnative/cucumber.rb', line 163 def install_log_assertion_steps Then('I should see a log entry of {string} for process {string}') do |, process| process = Nonnative.configuration.process_by_name(process) expect(Nonnative.log_lines(process.log, ->(l) { l.include?() }).first).to include() end Then('I should see a log entry of {string} in the file {string}') do |, path| expect(Nonnative.log_lines(path, ->(l) { l.include?() }).first).to include() end end |
#install_memory_assertion_step ⇒ Object
142 143 144 145 146 147 148 149 150 151 |
# File 'lib/nonnative/cucumber.rb', line 142 def install_memory_assertion_step Then('the process {string} should consume less than {string} of memory') do |name, mem| process = Nonnative.pool.process_by_name(name) _, size, type = mem.split(/(\d+)/) actual = process.memory.send(type) size = size.to_i expect(actual).to be < size end end |