Backo
Backo

Reputation: 18871

How to name RSpec 'context' statement "arguments"?

I am using Ruby on Rails 3.0.9 and RSpect 2 (BTW: with 'factory_girl_rails', 'capybara' and 'guard-rspec' gems). I would like to know how I should name context statement arguments in order to build consistent and maintainable spec file codes.

I mean, if in a rspec.rb file I have a code like the following

describe User do
  context "Argument"
    ...
    context "Argument nested"
      ...
    end
      context "Argument nested 1"
        ...
          context "Argument nested ..."
            ...
          end
      end
  end
end

maybe, for convenience, I may state "Argument nested < n >" context names in a way so to create "understandable patterns" in order to have\gain some "design advantages" (eg: those related to application code readability, developer productivity, ...). But, how to do that (maybe following a "Ruby on Rails Way to do things"...)?

Upvotes: 0

Views: 1386

Answers (1)

Jonah
Jonah

Reputation: 17958

I like the style Jared recommends here: http://blog.carbonfive.com/2010/10/21/rspec-best-practices/

Upvotes: 2

Related Questions