Comments (8)
You can setup Guard like so:
guard :alfred, :all_on_start => false do
watch(%r{^app/controllers/(.+)\.rb$}) { |m| "spec/alfreds/#{m[1]}.rb" }
watch(%r{^spec/alfreds/(.+)\.rb$}) { |m| "spec/alfreds/#{m[1]}.rb" }
end
from guard-alfred.
Yes you're right. How about when running all specs, it re-generates fixtures also. Is there a way to not re-generate a fixture when the controller hasn't changed or been saved?
from guard-alfred.
I think it's impossible to track all files that influence the controller response (Models, Serializers etc.) I think it would be a better solution to stub the method that generates the dynamic value:
Alred.define do
controller SomeController do
scenario 'foo' do
setup do { current_user.stub(:dynamic).and_return(:static)
end
end
end
from guard-alfred.
I suppose. But what about timestamp values, such as created_at and updated_at? These are pretty standard in API responses. To stub those on each request would be a pain.
Could we somehow check if the fixture needs to be re-generated? Such as checking the source file, if it has changed?
from guard-alfred.
I think it's a good idea to re-render fixtures before running a whole suite. For instance when you change the behavior of String#some_method in lib/core_ext/string.rb this change could influence almost every response in your application.
from guard-alfred.
Hmm true. You're right about that. A lot of code outside of controllers can alter the response. There's no solution to that.
from guard-alfred.
Maybe we can implement a prompt for re-rendering all fixtures in the Guard::Alfred#run_all method. This method is invoked when you run the whole suite with guard. Something like 'Do you want to render all fixtures?'. I think it's pretty easy to implement with https://github.com/JEG2/highline.
from guard-alfred.
An alternative could be to simply add the fixtures folder to your .gitignore. It wouldn't matter if there are fixtures changes.
from guard-alfred.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from guard-alfred.