I hereby claim:
- I am timwingfield on github.
- I am timwingfield (https://keybase.io/timwingfield) on keybase.
- I have a public key whose fingerprint is 15D3 BF38 A26A 376D F742 2293 22A1 893F 2406 65FB
To claim this, I am signing this object:
| import * as someReduxActions from '../actions/someReduxActions' | |
| beforeEach( () => { | |
| sinon.stub(someReduxActions, 'fetchSomething').returns('we have results') | |
| }) |
I hereby claim:
To claim this, I am signing this object:
| //The method under test | |
| on: function(event, fn){ | |
| $("#" + this.currentView.modalId).on(event, fn); | |
| } | |
| //The Jasmine spec | |
| describe("account/company", function() { | |
| Given(function() { this.view = { modalId: "modalId" } }); | |
| Given(function() { subject = new PopupView(this.view) }); | |
| extend 'the.models.OurModel', class OurModel extends Backbone.Model | |
| url: -> | |
| "#{relativeUrlRoot}/some_controller/some_action#{@get 'channel_type'}_data/#{@get 'end_point_id'}" | |
| parse: (response) -> | |
| response.id = "#{response.end_point_id}_#{response.channel_type}" | |
| response |
| describe("Spying on a window object", function() { | |
| describe("working with the object", function() { | |
| beforeEach(function () { | |
| this.name = "Spongebob"; | |
| this.subject = new Klass(this.name); | |
| }); | |
| it("should have properties", function() { | |
| expect(this.subject.properties).toBeDefined(); | |
| }); |
| ProjectNamespace.Helpers.Converters = (function() { | |
| var convertToDate, convertToFloat, convertToInteger, isValidDate; | |
| isValidDate = function(d) { | |
| if (Object.prototype.toString.call(d) === "[object Date]") { | |
| return !isNaN(d.getTime()); | |
| } | |
| return false; | |
| }; | |
| convertToDate = function(input) { | |
| var d; |
| describe Parent do | |
| describe "initializing a new parent" do | |
| context "and using a hash" do | |
| Given { @hash = {:id => "55", :name => "Spongebob" } } | |
| When { @parent = Parent.new @hash } | |
| Then { @parent.name.should == "Spongebob" } | |
| Then { @parent.id.should == "55" } | |
| end | |
| context "and not using a hash" do |
| describe "app.Agent", -> | |
| Given -> @car = new Backbone.Model | |
| Given -> spyOn(@car, "get") | |
| Given -> @car.get.when('phone').thenReturn("123-456-789") | |
| Given -> @car.get.when('name').thenReturn("juice") | |
| Then -> expect(@car.get).toHaveBeenCalledWith('phone') | |
| Then -> expect(@car.get).toHaveBeenCalledWith(jasmine.any(String)) | |
| Then -> expect(@car.get).toHaveBeenCalledWith jasmine.argThat (arg) -> | |
| arg.length < 5 |
| #!/usr/bin/env ruby | |
| # encoding: UTF-8 | |
| # example for getting the battery settings https://gist.github.com/176025 | |
| info = `ioreg -rc "AppleSmartBattery"` | |
| battery = %w(ExternalConnected CurrentCapacity MaxCapacity IsCharging).inject({}) do |hash, property| | |
| hash[property.to_sym] = info[/"#{property}" = (.*)$/, 1]; hash | |
| end |
| [TestFixture] | |
| public class When_saving_a_vehicle_in_the_view_model_with_a_vehicle : Specification | |
| { | |
| private VehicleViewModel _viewModel; | |
| private Mock<IVehicleRepository> _repository; | |
| protected override void before_each() | |
| { | |
| _repository = new Mock<IVehicleRepository>(); | |
| _viewModel = new VehicleViewModel(_repository.Object); |