Sha256: 802a74d38008d668792f79816322c3711916d794bdbba01c81434d88749e45d0

Contents?: true

Size: 536 Bytes

Versions: 2

Compression:

Stored size: 536 Bytes

Contents

require "spec_helper"
require "render_with_view/rspec_matcher"

RSpec.describe "RSpec matcher" do
  let(:ctrl) { FakeController.new }
  subject { ctrl.render_with_view(:index, thing: 1) }

  # short form
  it { should(set_view_local(:thing)) }
  it { should_not(set_view_local(:other_thing)) }

  # long form
  it "takes and matches arguments" do
    expect(subject).to(set_view_local(:thing, 1))
    expect(subject).to_not(set_view_local(:thing, 2))
  end

  def assigns(key)
    ctrl.instance_variable_get("@#{key}".to_sym)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
render_with_view-0.2.1 spec/render_with_view/rspec_matcher_spec.rb
render_with_view-0.2.0 spec/render_with_view/rspec_matcher_spec.rb