forked from rspec/rspec-rails
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Include acceptance specs for smoke app
Add an acceptance spec to the smoke app verifying that neither rspec-rails nor rspec-mocks has broken working models. This ensures the following basic functionality: - stubbing model class methods - attribute methods (currently the only dynamic AR type method we support)
- Loading branch information
1 parent
4e8c36c
commit 811e1cb
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
example_app_generator/spec/features/model_mocks_integration_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe "Using rspec-mocks with models" do | ||
it "supports stubbing class methods on models" do | ||
allow(Widget).to receive(:all).and_return(:any_stub) | ||
expect(Widget.all).to be :any_stub | ||
end | ||
|
||
it "supports stubbing attribute methods on models" do | ||
a_widget = Widget.new | ||
allow(a_widget).to receive(:name).and_return("Any Stub") | ||
|
||
expect(a_widget.name).to eq "Any Stub" | ||
end | ||
end |