Skip to content
Adds a `shared` method to RSpec
Ruby
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
spec
.gitignore
.rspec
.rvmrc
Gemfile
README.md
Rakefile
rspec-shared.gemspec

README.md

rspec-shared

This gem adds a shared method to RSpec Core which basically a let that is shared across examples.

Synopsis

describe do
  @@one = 1

  def shared_value
    @@one = @@one.next
  end

  shared(:foo) { shared_value }

  example { foo.should eq(2) }
  example { foo.should eq(2) }

  describe do
    example { foo.should eq(2) }
  end
end
Something went wrong with that request. Please try again.