Skip to content

Commit

Permalink
Upgraded shoulda.
Browse files Browse the repository at this point in the history
It was preventing rake tasks from working in the test environment.

thoughtbot/shoulda#223

Shoulda Matchers 2.0 removed the `assign_to` and
`respond_with_content_type` matchers. They recommend testing assignments
implicitly via integration tests, but making sure these controller
actions are all covered by our integration tests is a detour I don't
want to make right now.
  • Loading branch information
eostrom committed Mar 20, 2014
1 parent 43f89ff commit 8211dd5
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 13 deletions.
11 changes: 6 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,12 @@ GEM
ffi (~> 1.0.9)
json_pure
rubyzip
shoulda (3.0.1)
shoulda-context (~> 1.0.0)
shoulda-matchers (~> 1.0.0)
shoulda-context (1.0.0)
shoulda-matchers (1.0.0)
shoulda (3.5.0)
shoulda-context (~> 1.0, >= 1.0.1)
shoulda-matchers (>= 1.4.1, < 3.0)
shoulda-context (1.1.6)
shoulda-matchers (2.5.0)
activesupport (>= 3.0.0)
simplecov (0.4.2)
simplecov-html (~> 0.4.4)
simplecov-html (0.4.5)
Expand Down
15 changes: 12 additions & 3 deletions spec/controllers/archived_assessments_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
context '(authorized)' do
let(:user) { Factory.create(:reader) }

it { should assign_to(:assessments) }
it 'assigns to assessments' do
expect(assigns(:assessments)).not_to be_nil
end

it { should render_template :index }
end
end
Expand All @@ -26,8 +29,14 @@
context '(CSV)' do
let(:show_params) { {:format => :csv, :id => assessment.id} }

it { should assign_to :answers }
it { should respond_with_content_type(:csv) }
it 'assigns to answers' do
expect(assigns(:answers)).not_to be_nil
end

it 'responds with a csv' do
expect(response.content_type).to eq('text/csv')
end

it { should_not render_with_layout }
end
end
Expand Down
15 changes: 12 additions & 3 deletions spec/controllers/assessments_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
context '(no existing assessment)' do
let(:assessment) { nil }

it { should assign_to :assessment }
it 'assigns to assessment' do
expect(assigns[:assessment]).to be_present
end

it { should render_template :new }
end

Expand Down Expand Up @@ -61,8 +64,14 @@
context '(CSV)' do
let(:show_params) { {:format => :csv} }

it { should assign_to :answers }
it { should respond_with_content_type(:csv) }
it 'assigns to answers' do
expect(assigns(:answers)).not_to be_nil
end

it 'responds with a csv' do
expect(response.content_type).to eq('text/csv')
end

it { should_not render_with_layout }
end
end
Expand Down
9 changes: 7 additions & 2 deletions spec/controllers/todos_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@
context '(CSV)' do
let(:params) { {:format => :csv} }

it { should assign_to :todos }
it { should respond_with_content_type(:csv) }
it 'assigns to todos' do
expect(assigns[:todos]).to be_present
end

it 'responds with a csv' do
expect(response.content_type).to eq('text/csv')
end
end
end
end
Expand Down

0 comments on commit 8211dd5

Please sign in to comment.