In RSpec – how can I test if one attribute is less (or more) than another
It is generally recommended to use expect, not should. For instance: expect(@car.date_from).to be <= @car.date_till Resources: – BetterSpecs examples – Rspec Docs
It is generally recommended to use expect, not should. For instance: expect(@car.date_from).to be <= @car.date_till Resources: – BetterSpecs examples – Rspec Docs
Declaritive is the proper way, IMO. If youre talking about page .aspx file names, you’re doing it wrong. The purpose of the story is to facilitate communication between developers and non-develoeprs. Non-developers don’t care about products.aspx, they care about a product listing. Your system does something the non-developers find value in. This is what you’re … Read more
If you want to run a single test for that feature, use the -n or –name flag which seems to want the text after Scenario: behave -n ‘This is a scenario name’ You can run a feature file by using -i or –include flags and then the name of the feature file. behave -i file_name.feature … Read more
BDD “tests” exist at multiple different levels of granularity, all the way up to the initial project vision. Most people know about the scenarios. A few people remember that BDD started off with the word “should” as a replacement for JUnit’s “test” – as a replacement for TDD. The reason I put “tests” in quotes … Read more
I found out that Sinon.JS has support for manipulating the JavaScript clock, via sinon.useFakeTimers, as described in its Fake Timers documentation. This is perfect since I already use Sinon for mocking purposes, and I guess it makes sense that Mocha itself doesn’t support this as it’s more in the domain of a mocking library. Here’s … Read more
For unit-testing you can try http://code.google.com/p/js-test-driver/ JsTestDriver consist of a single JAR file which contains everything you need to get started. For in depth discussion of command line option see GettingStarted. Here is an overview of how JsTestDriver works at runtime…
Capybara is a tool that interacts with a website the way a human would (like visiting a url, clicking a link, typing text into a form and submitting it). It is used to emulate a user’s flow through a website. With Capybara you can write something like this: describe “the signup process”, :type => :feature … Read more
I think this particular issue can be solved elegantly with a Domain Event.
The process is as follows: Install the rspec gem from the console: gem install rspec Then create a folder (we’ll name it root) with the following content: root/my_model.rb root/spec/my_model_spec.rb #my_model.rb class MyModel def the_truth true end end #spec/my_model_spec.rb require_relative ‘../my_model’ describe MyModel do it “should be true” do MyModel.new.the_truth.should be_true end end Then in the … Read more
from command line, you can use the following: –no-capture for any stdout output to be printed immediately. –no-capture-stderr for any stderr output to be printed immediately.