Sha256: 2f4ad5e091c166712fd2223962a5910e3ba5f95cbde3be8b5e1969ad5dfd4024

Contents?: true

Size: 1016 Bytes

Versions: 3

Compression:

Stored size: 1016 Bytes

Contents

require 'spec_helper'

if Rails::VERSION::MAJOR >= 4
  describe StoresController do
    describe 'GET show' do
      let(:tatsu_zine) { Store.create! name: 'Tatsu-zine' }
      before { get :show, :id => tatsu_zine.id }
      subject { assigns :store }
      it { should == tatsu_zine }
    end

    describe 'POST create' do
      it { expect { post :create, :store => {name: 'Tatsu-zine', url: 'http://tatsu-zine.com'} }.to change(Store, :count).by(1) }
    end
  end

  describe Admin::BooksController do
    context "this controller doesn't permit price of new book" do
      describe 'POST create' do
        before { post :create, :book => {title: 'naruhoUnix', price: 30} }

        it 'should not save price of the book' do
          expect(Book.last.price).to be_nil
        end
      end
    end
  end

  describe Admin::AccountsController do
    describe 'POST create' do
      it { expect { post :create, :admin_account => {name: 'amatsuda'} }.to change(Admin::Account, :count).by(1) }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
action_args-1.5.4 spec/controllers/strong_parameters_spec.rb
action_args-1.5.3 spec/controllers/strong_parameters_spec.rb
action_args-1.5.2 spec/controllers/strong_parameters_spec.rb