Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- RSpec.describe 'Test Description' do
- attr_reader :result
- before(:all)
- @result = build_result({some_parameters})
- end
- context 'Some context' do
- it 'Looks lik a result' do
- expect(result.something).to ...
- end
- it 'Feels lik a result' do
- expect(result.something).to ...
- end
- end
- end
- RSpec.describe 'Test Description' do
- attr_reader :result
- before(:all)
- @result = build_result({some_parameters})
- end
- context 'Some context' do
- it_behaves_like "A result" result
- end
- end
- RSpec.describe 'Test Description' do
- context 'for params x and y' do
- let(:expected_x) { 'x' }
- let(:expected_x) { 'y' }
- subject { build_result({x: 'x', y: 'y'}) }
- specify :aggregate_failures do
- expect(subject.x).to eq(expected_x)
- expect(subject.y).to eq(expected_y)
- end
- end
- end
- shared_examples_for "A result" do |argument|
- # some tests with argument
- end
- it_behaves_like "A result", my_argument
- let(:result) { build_result({some_parameters}) }
- describe '#type_id' do
- before { @resource = FactoryGirl.create :device }
- before { @type = Type.find @resource.type_id }
- it 'sets the type_id field' do
- expect(@resource.type_id).to equal(@type.id)
- end
- end
- describe '#type_id' do
- let(:resource) { FactoryGirl.create :device }
- let(:type) { Type.find resource.type_id }
- it 'sets the type_id field' do
- expect(resource.type_id).to equal(type.id)
- end
- end
Add Comment
Please, Sign In to add comment