Sha256: c757b27183a88a71b38d15e122fe1e16938c7f79cb5b024e4b7ba97f7c31c100

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 KB

Contents

require "spec_helper"
require 'action_controller'
require "rails-footnotes/notes/assigns_note"

describe Footnotes::Notes::AssignsNote do
  let(:note) do
    @controller = mock
    @controller.stub(:instance_variables).and_return([:@action_has_layout, :@_status])
    @controller.instance_variable_set(:@action_has_layout, true)
    @controller.instance_variable_set(:@_status, 200)
    Footnotes::Notes::AssignsNote.new(@controller)
  end
  subject {note}

  before(:each) {Footnotes::Notes::AssignsNote.ignored_assigns = []}

  it {should be_valid}
  its(:title) {should eql 'Assigns (2)'}

  specify {note.send(:assigns).should eql [:@action_has_layout, :@_status]}
  specify {note.send(:to_table).should eql [['Name', 'Value'], [:@action_has_layout, "true"], [:@_status, "200"]]}

  describe "Ignored Assigns" do
    before(:each) {Footnotes::Notes::AssignsNote.ignored_assigns = [:@_status]}
    it {note.send(:assigns).should_not include :@_status}
  end

  it "should call #mount_table method with correct params" do
    note.should_receive(:mount_table).with(
      [['Name', 'Value'], [:@action_has_layout, "true"], [:@_status, "200"]], {:summary=>"Debug information for Assigns (2)"})
    note.content
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails-footnotes-3.7.7 spec/notes/assigns_note_spec.rb
rails-footnotes-3.7.6 spec/notes/assigns_note_spec.rb
rails-footnotes-3.7.5 spec/notes/assigns_note_spec.rb