Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Feature request) Make mocked model to_s more elegant #30

Open
Looooong opened this issue Jun 21, 2018 · 0 comments
Open

(Feature request) Make mocked model to_s more elegant #30

Looooong opened this issue Jun 21, 2018 · 0 comments

Comments

@Looooong
Copy link

Current behaviour:

m = mock_model(Transaction)
m.to_s # Returns something like Transaction_#<RSpec::ExampleGroups::0x00564be9720728>

I would like to_s to also show what is stubbed inside that model, so that the spec is easier to read. For example:

m = mock_model(Transaction, type: :transfer)
m.to_s # Transaction(type: :transfer) #<RSpec::ExampleGroups::0x00564be9720728>

it { is_expected.to be_able_to(:read, mock_model(Transaction, type: :transfer)) }
# Output: It should be able to read Transaction(type: :transfer) #<RSpec::ExampleGroups::0x00564be9720728>

It will look similar to what ActiveRecord does. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant