Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A simple let for shoulda
tag: v0.0.2

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
gemfiles
lib/shoulda
test
.travis.yml
Appraisals
Gemfile
Gemfile.lock
Rakefile
Readme.md
shoulda-let.gemspec

Readme.md

A simple let for shoulda

Install

gem install shoulda-let

# Gemfile
gem "shoulda-let", :require => "shoulda/let"

Usage

context "foo" do
  setup do
    @result = let(:thing)
  end

  let(:thing){ "parent" }

  context "with something" do
    let(:thing){ "something" }
    should "be something" do
      assert_equal "something", @result
    end
  end

  context "with cache" do
    let(:thing){ rand }

    should "be stable" do
      assert_equal @result, let(:thing)
    end

    should "be different" do
      assert_not_equal $last_thing, let(:thing)
    end

    should "prepare for be different" do
      $last_thing = let(:thing)
    end
  end

  context "with parent" do
    should "be parent" do
      assert_equal "parent", @result
    end
  end
end

Author

Michael Grosser
michael@grosser.it
License: MIT
Build Status

Something went wrong with that request. Please try again.